I am using data provider and test ng to run the same test multiple times using different values from a list. However, I have several tests and I want them all to run one by one so Test 1 -> Test 2 -> Test 3, for each item in the list. Right now Test 1 is running 4 times for all 4 elements in the list, and then Test 2 ->Test 3.
@DataProvider
public Object[][] data() throws CsvValidationException, IOException, URISyntaxException {
...get list..
Object[][] element = new Object[list.size()][1];
for (int i = 0; i < list.size(); i++) {
element[i][0] = list.get(i);
}
return element;
}
@Test(dataProvider = "data",priority = 1)
public void test(Element element) {
System.out.println("test1");
}
@Test(priority=2)
public void test2() {
System.out.println("test2");
}
So I want the output to be 'test1' 'test2'... 'test1' 'test2'...'test1''test2' not 'test1'..'test1'..'test1'..'test2'.