@DataProvider(name = "name")
public static Object[][] getMyName() {
return new Object[][] { new Object[] { "fujian" },
new Object[] { "xinxiu" }
};
}
@DataProvider(name = "age")
public static Object[][] getAge() {
return new Object[][] { new Object[] { 32 },
new Object[] { 30 }
};
}
@DataProvider(name = "name-age")
public static Object[][] getNameAndAge(){
return combine(getMyName(), getAge());
}
public static Object[][] combine(Object[][] a1, Object[][] a2){
LinkedList<Object[]> objectCodesList = new LinkedList<Object[]>();
for(Object[] o : a1){
for(Object[] o2 : a2){
objectCodesList.add(ArrayUtils.addAll(o, o2));
}
}
return objectCodesList.toArray(new Object[0][0]);
}
@Test(dataProvider = "name-age")
public void test(String name, int age){
System.out.println(name + age);
}
public static Object[][] getMyName() {
return new Object[][] { new Object[] { "fujian" },
new Object[] { "xinxiu" }
};
}
@DataProvider(name = "age")
public static Object[][] getAge() {
return new Object[][] { new Object[] { 32 },
new Object[] { 30 }
};
}
@DataProvider(name = "name-age")
public static Object[][] getNameAndAge(){
return combine(getMyName(), getAge());
}
public static Object[][] combine(Object[][] a1, Object[][] a2){
LinkedList<Object[]> objectCodesList = new LinkedList<Object[]>();
for(Object[] o : a1){
for(Object[] o2 : a2){
objectCodesList.add(ArrayUtils.addAll(o, o2));
}
}
return objectCodesList.toArray(new Object[0][0]);
}
@Test(dataProvider = "name-age")
public void test(String name, int age){
System.out.println(name + age);
}