2

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

Martin Mussmann
  • 697
  • 2
  • 9
  • 20
  • can you share how u run the tests in parallel? – Amey May 07 '12 at 20:32
  • Added a example, there's not much to it. but i can add it all if needed. – Martin Mussmann May 07 '12 at 20:41
  • Do you see 2 nodes with 5 instances each of firefox in your selenium-grid console? You can find the console at http://yourip:4444/grid/console – A.J May 07 '12 at 20:43
  • Yes, they have 5x firefox icons. – Martin Mussmann May 07 '12 at 20:47
  • 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 May 07 '12 at 20:52
  • Each node should be able to run 5 instances in parallel of any combination of registered browsers. Share the launch command for the hub and the node. – David Santiago Turiño May 07 '12 at 21:35
  • @A.J. I will do that to night if I haven't solved the issue, but I think I came up with a possible reason. The VM I used is a single core not dual core, my guess is that that's the issue. – Martin Mussmann May 08 '12 at 05:01
  • I've added some more detailed info, it didn't help to run the node on a multicore machine, and it works fine if i just start 2 nodes, then mbunit runs 2 test in parallel. but with only 1 node, not so much :( – Martin Mussmann May 08 '12 at 16:22

1 Answers1

0

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.

Anuragh27crony
  • 2,957
  • 1
  • 19
  • 29
  • Sadly that didn't help. I already start them that way. maybe im missing something else, maybe it's how i use MBUnit – Martin Mussmann May 08 '12 at 16:23
  • Done some more digging and it looks like the node server receive the sessions but doesn't execude them parallel i get this message the same number of times i set degree of parallelism to: `22:35:21.530 INFO - Executing: [new session: {platform=ANY, browserName=firefox, version=}] at URL: /session)` – Martin Mussmann May 08 '12 at 20:41
  • Any clues?, the node I use now is an I7 so should have plenty of cores :) – Martin Mussmann May 08 '12 at 20:42
  • From what i can gather the nodes only que up the tests. E.g. I have 6 tests and paralellisem(4) with 2 nodes, when i start the test each node receive 2 sessions which it then runs before asking for new. This actually saves some time, but is this all it does?, did i misunderstand when i thought each node could run multiple test in parallel or is there still something I'm missing? – Martin Mussmann May 08 '12 at 20:56
  • 1
    I think my setup is correct as it is, it runs different browser instances in parallel not problem. So i can run IE,Chrome,Firefox at the same time. Just not 3x firefox. I'll mark above as an anwser since that is the commands i use to start. – Martin Mussmann May 10 '12 at 19:44
  • OP was being kind. The answer does not give a solution to the actual question. Answer only shows how to setup 5 instances on a single node, but when test is run only one instance will be used. – Xwris Stoixeia Sep 20 '17 at 19:59
  • @XwrisStoixeia : The answer posted assumes that tests are being invoked in parallel and not sequential as mentioned in "I've created 6 dummy tests using MBUNIT and added [Paralizable] to make them run side by side". Grid doesn't run tests in parallel until unless it has been submitted in one go and "maxInstances" is the setting for it. – Anuragh27crony Sep 22 '17 at 08:42
  • Imho the following answers the original OP question: 1) You need to setup -real nodes- first so use -role wd instead of -role node 2) 'Real nodes' also require config via a json file, look below: https://stackoverflow.com/questions/40310233/selenium-3-0-1-chrome-node-configuration – Xwris Stoixeia Sep 27 '17 at 09:47
  • @XwrisStoixeia: I think there is some confusion about flags. "wd" & "rc" are flags for letting grid know which tests to run (webdriver or selenium rc) on a particular node . As per official documentation "For backwards compatibility "wd" and "rc" roles are still a valid subset of the "node" role". Essentially "node" means "wd". https://groups.google.com/forum/#!topic/selenium-users/KZUwccCdxe4 Configuring a node via json is more easy and maintainable with more options. Only difference in passing arguments via CLI is rest are assumed default but doesn't mean it will perform different. – Anuragh27crony Sep 27 '17 at 14:41
  • Json config actually creates 'real' nodes when using maxInstance. With your solution, I can see several browser instances; however only on the FE (grid console); as in the BE; they are all treated as one instance. Only when using json config you are able to tell the grid to run the tests on different browser instances.Try it – Xwris Stoixeia Sep 28 '17 at 09:53