fixed a possible synch problem with the invocation of @BeforeClass
diff --git a/src/main/org/testng/internal/TestMethodWorker.java b/src/main/org/testng/internal/TestMethodWorker.java
index 789c750..7f81755 100644
--- a/src/main/org/testng/internal/TestMethodWorker.java
+++ b/src/main/org/testng/internal/TestMethodWorker.java
@@ -88,23 +88,20 @@
// Invoke the before class methods if not done already
//
ITestClass testClass = tm.getTestClass();
-
- boolean invokeBefore= false;
+
+ // the whole invocation must be synchronized as other threads must
+ // get a full initialized test object (not the same for @After)
synchronized(m_invokedBeforeClassMethods) {
if (! m_invokedBeforeClassMethods.containsKey(testClass)) {
m_invokedBeforeClassMethods.put(testClass, testClass);
- invokeBefore= true;
+ m_invoker.invokeConfigurations(testClass,
+ testClass.getBeforeClassMethods(),
+ m_suite,
+ m_parameters,
+ null /* instance */);
}
}
- if(invokeBefore) {
- m_invoker.invokeConfigurations(testClass,
- testClass.getBeforeClassMethods(),
- m_suite,
- m_parameters,
- null /* instance */);
- }
-
//
// Invoke test method
//