0

I'm using testNg for Selenium automation using java, I'm using @DataProvider to get data from excel and pass as an argument to the test Script.

Suppose if I have 10 rows of data in Excel, my test case will execute 10 times sequentially, but now I want to run those 10 tests in parallel, all at the same time using threads.

Can this be done? If yes, can somebody provide me a sample example for the same?

Alex Kulinkovich
  • 4,408
  • 15
  • 46
  • 50
Nilamber Singh
  • 804
  • 1
  • 14
  • 33
  • Please check this - http://stackoverflow.com/questions/22138944/selenium-test-execution-in-parallel-using-testng?rq=1 – vv88 Jun 27 '16 at 11:59

4 Answers4

1

You can specify "parallel=true" in your dataprovider method which enables parallel execution.

Sample Code:Hope this helps.

@DataProvider(name="browserinfo",parallel=true)
    public static Object[][] browserinfo(){
        Object[][] testdata=new Object[][] {
            {Platform.WINDOWS,"firefox"},
            {Platform.LINUX,"chrome"},
            {Platform.MAC,"safari"}};

    return testdata;
}
0

Use sauce lab for parallel execution, there you can execute in virtual machines at a time 30 Threads.

One more suggestion you can use selenium grid which will run parallel execution in different machines.

Sireesha K
  • 95
  • 1
  • 4
0

BrowserStack and Sauce Labs both provide examples on parallel TestNG tests:

mfulton26
  • 29,956
  • 6
  • 64
  • 88
0

You can follow the link.You will get an idea. https://www.seleniumeasy.com/testng-tutorials/parallel-execution-of-test-methods-in-testng

Gobi
  • 283
  • 1
  • 5
  • 15