I am little bit confused by this testNG behavior.
Consider this simple testNG suite. Test2 depends on Test1. The below suite also starts Test2 only after Test1 which is great!
<suite name="testng-behvaior" parallel="none">
<test name="test1">
<parameter name="browser" value="chrome" />
<classes>
<class name="com.test.Test1" />
<class name="com.test.Test2" />
</classes>
</test>
</suite>
Above suite works just fine without any issues.
But consider this. As per testNG documentation, all the <test>
would be assigned to different thread. Since i have only one <test>
, only one thread is executing this suite which is fine. But it starts with Test2 before Test1.
<suite name="testng-behvaior" parallel="tests">
<test name="test1">
<parameter name="browser" value="chrome" />
<classes>
<class name="com.test.Test1" />
<class name="com.test.Test2" />
</classes>
</test>
</suite>
For me - in the above cases, parallel="tests"
and parallel="none"
should not make any difference and behave same.
What makes testNG should behave differently? How can i have the thread to execute the <classes>
within the <test>
in sequence?