有没有办法使用来自数据提供者的不同数据来执行多个测试方法?
例如
@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");
}
运行它的输出将是
Cedric 36
Verify2
Anne 37
Verify2