@parameters适合传递简单少量参数,复杂参数一般使用@DataProvider传递
@DataProvider语法:
@DataProvider(name = "dataproviderName")
public Object[][] createData([Method m]) {
return Array;
}
@Test(dataprovider="dataproviderName", dataProviderClass = dataProviderClassName.class)
public void test(parameters...){ }
1.简单返回Array
@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);
}
2.独立DataProvider类
public class StaticProv