Hello Cédric,
I have faced an ordering problem and I'm not sure it's related to the other threads commented recently.
Since @Test(sequential=true) has been deprecated and preserve-order has been implemented, how would you tell the TestNG engine to execute the test methods in a test class in the order they were defined?
Consider this XML file:
<!DOCTYPE suite SYSTEM "
http://testng.org/testng-1.0.dtd">
<suite name="TestNG Ordering" verbose="10">
<test name="01 - Test 01" preserve-order="true">
<classes>
<class name="runner.AutomationFlow"/>
</classes>
</test>
</suite>
There will be probably just one test class.
and this class:
package runner;
import org.testng.ITestContext;
import org.testng.annotations.Test;
public class AutomationFlow {
@Test(description="01 -Test 01")
public void test1(ITestContext context){
}
@Test(description="02 - Test 02")
public void test2(ITestContext context){
}
@Test(description="04 - Test 04")
public void test4(ITestContext context){
}
@Test(description="03 - Test 03")
public void test3(ITestContext context){
}
}
TestNG (5.14beta) does not consider any ordering:
[TestRunner] Found 4 applicable methods
[TestRunner] WILL BE RUN SEQUENTIALLY:
[TestRunner] WILL BE RUN IN RANDOM ORDER:
[TestRunner] runner.AutomationFlow.test1(org.testng.ITestContext)
[TestRunner] on instances
[TestRunner] runner.AutomationFlow@3c9217
[TestRunner] runner.AutomationFlow.test2(org.testng.ITestContext)
[TestRunner] on instances
[TestRunner] runner.AutomationFlow@3c9217
[TestRunner] runner.AutomationFlow.test3(org.testng.ITestContext)
[TestRunner] on instances
[TestRunner] runner.AutomationFlow@3c9217
[TestRunner] runner.AutomationFlow.test4(org.testng.ITestContext)
[TestRunner] on instances
[TestRunner] runner.AutomationFlow@3c9217
[TestRunner] ===
[Invoker 27692793] Invoking runner.AutomationFlow.test1
[Invoker 27692793] Invoking runner.AutomationFlow.test2
[Invoker 27692793] Invoking runner.AutomationFlow.test3
[Invoker 27692793] Invoking runner.AutomationFlow.test4
Excuse me if this is the same problem I reported a few weeks ago or if it's already been reported :)
FK