2
votes

I fear this is a very trivial question. But I'm having some trouble getting selenium Grid2 to run multiple test against a single node, from my understanding this should be possible by setting maxSessions.

This is my setup: -Hub runs completly standard -Node runs firefox with 5instances and 5 sessions enabled.

I've created 6 dummy tests using MBUNIT and added [Paralizable] to make them run side by side.

This is what I've done to test: 1: Start 2 nodes and run all tests (they run in parallel one on each node) 2: Turn off nodeA and run all tests

In step 2 is where i get stuck, i expected the last node would run 2 tests at once since the maxSessions is set to 5 but this doesn't happen, it only runs 1.

I suspect I've used a wrong parameter when starting the hub or node somewhere but right now i can't figure it out. anybody who want to help a newbie at Grid2? :)

This is roughly my code, very basic just for playing around:

[TestFixture]
public class RemoteTest
{
  [Test]
  [Parallelizable]
  public void StartClose()
  {
    DesiredCapabilities cap = DesiredCapabilities.Firefox();

    IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), cap);

    driver.Navigate().GoToUrl("http://www.google.dk");

    driver.Quit();
  }
}

Commands used:

java -jar selenium-server-standalone-2.14.0.jar -role hub

java -jar selenium-server-standalone-2.14.0.jar -role node -hub http://192.168.0.26:4444/grid/register

1
can you share how u run the tests in parallel? - Amey
Added a example, there's not much to it. but i can add it all if needed. - Martin Mussmann
Do you see 2 nodes with 5 instances each of firefox in your selenium-grid console? You can find the console at yourip:4444/grid/console - A.J
Yes, they have 5x firefox icons. - Martin Mussmann
Can you show the code you use to start hub and RCs? I don't think there is a problem in that. Still.. :) - A.J

1 Answers

0
votes

no question is trivial :)

To start a server (use the following command)

java -jar selenium-server-standalone-2.14.0.jar -role hub

To start a Node (use the following command)

java -jar selenium-server-standalone-2.14.0.jar -role node -hub http://localhost:4444/grid/register

Incase if u had tried to start a node with browsers as well (check the following command)

-browser browserName=firefox,version=3.6,maxInstances=5,platform=LINUX

maxInstances --> Signify the Max instances of same browser that can run on a Grid node

Selenium Grid: MaxSessions vs MaxInstances

If you specify capabilities in your test case that do not exist on your grid then there will be no match and the test will fail to run.

Please avoid running the tests from the Nodes and instead run tests from hub. I tried the same experiment where I ran the tests from the server (HUB) and I registered a node for running parallel test cases and everything worked perfect.