Hi, I am trying to get the ordering for TestNG to run through an entire instance of a DataProvider before moving onto the next, but am unable to get this to happen. Here is my test class
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;
@Test(singleThreaded = true)
public class TestNGSample {
@DataProvider(name = "DataProvider")
public static Object[][] createSLAs() {
return new Object[][] {
{ "Test1", "Test1.1" },
{ "Test2", "Test2.1" }
};
}
private String one;
private String two;
@Factory(dataProvider = "DataProvider")
public TestNGSample(String val1, String val2) {
one = val1;
two = val2;
}
@Test
public void first() {
System.out.println(one);
}
@Test(dependsOnMethods = { "first" })
public void second() {
System.out.println(two);
}
}
When I run this test, the output is
Test1
Test2
Test1.1
Test2.1
However, I would like the output to be
Test1
Test1.1
Test2
Test2.1
Can anyone help me to achieve this?
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/Uwq5DMKf6NoJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/AKxU8bCaAJkJ.
--Cédric
@BeforeGroups(groups="first")
public void first() {
System.out.println(one);
}
@Test(groups="first")