Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Selenium by (7k points)

I am currently setting Selenium Grid for running test suites on hub and distribute the tests over the nodes so that the test are executed on hub and distributed over nodes to execute them further. My test class has 4 tests and on running the test using RemoteDriver and passing the hub as URL and configured capabilities, it executes all four tests on Node1 and does not distribute it over to Node2. Also, it runs all 4 tests serially on Node1. What could be wrong here?

Hub Configuration :

C:\Proto\Selserversidedjars>java

    -jar selenium-server-standalone-2.44.0.jar

    -role hub -hubConfig DefaultHub.json

Node 1 Configuration : 

C:\Proto\Selserversidedjars>java

    -jar selenium-server-standalone-2.44.0.jar 

    -role node 

    -hub http://localhost:4444/grid/register

Node 2 Configuration :

C:\Proto\Selserversidedjars>java

    -jar selenium-server-standalone-2.44.0.jar

    -role node

    -nodeConfig DefaultNode1.json

    -port 6666

Defaulthub.json :

 {

  "host": null,

  "port": 4444,

  "newSessionWaitTimeout": -1,

  "servlets" : [],

  "prioritizer": null,

  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",

  "throwOnCapabilityNotPresent": true,

  "nodePolling": 5000,

  "cleanUpCycle": 5000,

  "timeout": 300000,

  "browserTimeout": 0,

  "maxSession": 5,

  "jettyMaxThreads":-1

}

DefaultNode1.json:

{

  "capabilities":

      [

        {

          "browserName": "*firefox",

          "maxInstances": 5,

          "seleniumProtocol": "Selenium"

        },

        {

          "browserName": "*googlechrome",

          "maxInstances": 5,

          "seleniumProtocol": "Selenium"

        },

        {

          "browserName": "*iexplore",

          "maxInstances": 1,

          "seleniumProtocol": "Selenium"

        },

        {

          "browserName": "firefox",

          "maxInstances": 5,

          "seleniumProtocol": "WebDriver"

        },

        {

          "browserName": "chrome",

          "maxInstances": 5,

          "seleniumProtocol": "WebDriver"

        },

        {

          "browserName": "internet explorer",

          "maxInstances": 1,

          "seleniumProtocol": "WebDriver"

        }

      ],

  "configuration":

  {

    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",

    "maxSession": 5,

    "port": 6666,

    "host": ip,

    "register": true,

    "registerCycle": 5000,

    "hubPort": 4444,

    "hubHost": ip

  }

}

My hub is started on port 4444, node 1 on 5555, node 2 at 6666. I am trying to execute 4 tests using TestNG. Is there a way to distribute those tests over multiple nodes or multiple instances on a single node?

1 Answer

0 votes
by (31.9k points)

Grid helps in distributing the tests over various nodes, if tests are sent serially it will distribute serially or if sent parallely, it would distribute on various nodes. Consider using TestNG to run tests parallely or venture to implement your own parallelism.

Want to learn Selenium, checkout our Selenium training.

Browse Categories

...