@DataProvider
public Object[][] allDatas(){
Object[][] datas = {{"张三","20"},{"李四","18"},{"王五","25"},{"赵六","30"}};
return datas;
}
//1、数据源的数据识别(dataProvider = "allDatas")
//2、通过测试方法形参来接受
@Test(dataProvider = "allDatas")
public void print(String name, String age){
//步骤
System.out.println("获取名字,获取年龄");
//打印名字
System.out.println(name);
System.out.println(age);
}
testng- @DataProvider数据驱动
最新推荐文章于 2024-04-12 23:17:53 发布