Hi,
I have a Base Test Class from which all my test classes inherit. There are some fields in the base class that are initialized before the suite execution.
When I run only one test - everything works fine. But when running several tests, the class fields are null during some of the tests.
I attach a zip file of the eclipse project that I created to demonstrate the problem.
It contains the base class:
public class BaseTest
{
protected String someGeneralSetting;
@BeforeSuite
public void init()
{
someGeneralSetting = "ABC";
}
}
And an example of a test class:
public class MyTest extends BaseTest
{
@Test
public void test1()
{
assert someGeneralSetting != null;
}
@Test
public void test2()
{
assert someGeneralSetting != null;
}
}
The xml is as follows:
<suite name="Suite" parallel="false">
<test name="Test1">
<classes>
<class name="MyTest">
<methods>
<include name="test1" />
</methods>
</class>
</classes>
</test>
<test name="Test2">
<classes>
<class name="MyTest">
<methods>
<include name="test2" />
</methods>
</class>
</classes>
</test>
</suite>
I expect that both tests will pass, but in fact only the second test passes, while the first fails.
Is this a bug, or am I doing something wrong?
Thanks,
Dikla