How to run testng test in parallel thread with data driven

29 views
Skip to first unread message

Abhay

unread,
Sep 28, 2020, 6:20:34 AM9/28/20
to testng-users
I have a testng test, which I need to run on 50 devices simultaneously & test data is stored in excel file.

As of now, it is running sequential manner,  like this - 
1. Read 1st rwo from Excel file (device setup data)
2. Run a deviceSetupTest1
3 Read 2nd row data from Excel file
4.  Run a deviceSetupTest1
It goes on till nth row.

I am looking to run this in parallel. Any suggestion.

Aliasger Kiranawala

unread,
Sep 28, 2020, 6:25:16 AM9/28/20
to testng-users
You can setup Selenium grid or can use Sauselabs or similar third party who provides virtual devices executions.

Amit Bhoraniya

unread,
Sep 28, 2020, 7:28:57 AM9/28/20
to testng...@googlegroups.com
Hi Abhay,

You can use data-provider-thread-count property. Below is an example,

<suite name="QAF Demo" verbose="0" data-provider-thread-count="2" parallel="methods">
<test name="Sample Test">
<classes>
<class name="com.infostretch.automation.SampleTest"/>
</classes>
</test>
</suite> And my test class is,
public class SampleTest {

@Test(dataProvider = "SearchProvider")
public void testMethod(String author, String country) {
//your code
}

@DataProvider(name = "SearchProvider")
public Object[][] getDataFromDataprovider() {
return new Object[][]
{
{"Amit", "India"},
{"Kishan", "UK"},
{"Rahul", "USA"}
};

}
}
Thanks, Amit Bhoraniya

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/0aaff981-eab0-40ee-ba59-0ed891deaf59n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages