Is there a way to execute several test methods in order using different data from the data provider?
e.g.
@DataProvider(name = "test1")
public Object[][] createData1() {
return new Object[][] {
{ "Cedric", new Integer(36) },
{ "Anne", new Integer(37)},
};
}
@Test(dataProvider = "test1")
public void verifyData1(String n1, Integer n2) {
System.out.println(n1 + " " + n2);
}
@Test
public void verifyData2() {
System.out.println("Verify2");
}
And the output of running this would be
Cedric 36
Verify2
Anne 37
Verify2
Here is one way to do it: use an annotation to specify which method should receive which data:
The annotation:
The output: