Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor - run multiple tests in parallel on different browsers

I can't find any information on how to set this up, but it seems like a pretty basic concept, so I'm sure there's an answer out there.

I know how to run protractor on different browsers by setting the browserName property of the capabilities object in the config. And that's working great. I can set it to 'chrome' or 'firefox' or whatever I need and it runs just as expected. But the only way to run a single test suite against multiple browsers (as far as I know) is to create separate config files, each with a different browserName and then run each browser with its own config. This works, but its really slow because tests are then running in sequence, rather than concurrently.

Is there any way to run it on multiple browsers in parallel?

Can it be done on SauceLabs? or even using a local Selenium-Grid?

We are just trying to streamline our testing process and this would be a huge help. Any suggestions or info would be greatly appreciated. Thanks in advance.

like image 604
tennisgent Avatar asked Dec 19 '13 21:12

tennisgent


People also ask

Can you run parallel tests in 2 different browsers?

With Parallel Testing, you can run the same test on different browser/device combinations i.e. cross-browser testing, or run different tests on the same or different browser/device combinations. Parallel Testing will help you reduce the run time of your test suite, resulting in faster build times and faster releases.

How do you run multiple test cases in parallel?

We can run multiple test cases using TestNG test suite in Selenium webdriver. To execute test cases simultaneously, we have to enable parallel execution in TestNG. A TestNG execution is driven by the TestNG xml file. To trigger parallel execution we have to use the attributes – parallel and thread-count.

How do you run test cases sequentially in a protractor?

You could specify a glob that will load files in alphabetical order, or pass a list that forces sequential execution in the order you specify. specs: [ 'test/stories/login. js', 'test/stories/home/overview. js', 'test/stories/home/purchase/widget.


1 Answers

There's new option called multiCapabilities for that:

multiCapabilities: [{   'browserName': 'chrome' }, {   'browserName': 'firefox' }], 

Here's a complete example.

like image 171
Paolo Moretti Avatar answered Sep 24 '22 19:09

Paolo Moretti