seleniumselenium-webdriverselenium-grid2

How to execute a batch of Selenium tests in parallel on a Selenium Grid


I have a Selenium Grid host on machine H and I have two grid nodes: machine N1 and machine N2. Both nodes have the same capabilities.

I have four tests: test1 => test4. I launch the tests on the host machine using nunit console: nunit3-console Test.dll --where="method =~ Test".

All tests are executed on machine N1. When I launch them again, all tests are executed on machine N2. Next time on machine N1 and so on.

I expected to have test1 executed on N1, test2 on N2, test3 on N1 and test4 on N2.

I tried to put "[assembly: Parallelizable(ParallelScope.Fixtures)]" in AssemblyInfo.cs but that didn't help. The tests are still all executed on the same node.

What am I missing?


Solution

  • Use the NUnit3 Parallelizable attribute. If you put the [Parallelizable] annotation above each test fixture (class), then each class's tests will run as a group on a separate browser/tab. To get a Test to run on a specific node, you'll need to define a desiredCapability. I use the undocumented applicationName capability to do so.