方法一
执行脚本:
import org.testng.annotations.Parameters;#注意要引入这个包
public class NewTestA {
@Test
@Parameters("test1") //设置测试方法的入参
public void b2(String test1) throws Exception {
System.out.println(test1);
Thread.sleep(5000);
}
}
xml配置设置
方法二:
执行脚本:
public class NewTestA {
//定义对象数组 这里分别会循环取数值取跑对应调用的测试用例
@DataProvider(name="user")
public Object[][] Users(){
return new Object[][]{
{"testingwtb","a123456"},{"testingwtb2","a1234561"}
};
}
@Test(dataProvider="user")
public void b2(String test1,String test2,String uu) throws Exception {
System.out.println(test1);
System.out.println(test2);
Thread.sleep(5000);
}
}
xml配置设置: