JITHIN :
I have a testng
test like this
@Test
public void test(){
for(String s:list){
// doing the test
}
}
The test time increases as the contents in list
increases. If a single iteration takes X milliseconds, then for a 100 iteration its gonna take 100X milliseconds.
I want to reduce the maven build time so I thought of running the test in parallel.
Is there any way for my testng
test to run in parallel with the remaining maven build?
SirDiR aka Tymur Kubai :
Use paralleled Dataprovider
@DataProvider(parallel = true)
public Object[][] listToArrays() {
List<String> list = new ArrayList();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
Object[][] array = new Object[list.size()][1];
for (int i = 0; i < list.size(); i++) {
array[i][0] = list.get(i);
}
return array;
}
@Test(dataProvider = "listToArrays")
public void test(String s) {
System.out.println(s + " " + Thread.currentThread().getId());
//do your test with s
}
p.s. I don't know the context, but feel that you doing something wrong