is it possible to run the tests in parallel using multiple environments and tests workers

1,399 views
Skip to first unread message

Sanja P

unread,
Jun 20, 2016, 9:27:03 AM6/20/16
to NightwatchJs
In nightwatch.json, "test_workers" is set to 4.
If i run all the test files in one environment (for example Firefox), than 4 instances of Firefox will be open and then the tests will be distributed to run in parallel. 
If i run all the test files in two environments (for example Firefox and Chrome), 2 child process will be started, one for Firefox one for Chrome. Only one instance of Firefox or Chrome will be open and all the tests will be executed one by one. 
Is it possible to run the set of tests on multiple environments (for example, Firefox and Chrome) and than using the test_workers property each environment to start 4 instances to distributed the individual tests in order to short the time for executing the set of tests.
If it is possible, could you please advice me how I can achieve it. You can see how i run the tests in the attached ss. 

Here is my Nightwatch.json

{
  "test_workers": {
  "enabled": true,
  "workers": 4
},
  "src_folders" : ["tests"],
  "output_folder" : "reports",
  "custom_commands_path" : "commands",
  "custom_assertions_path" : "",
  "page_objects_path" : "pages",
  "globals_path" : "globals/globals.js",

  "selenium" : 
  {
    "start_process" : true,
    "server_path" : "lib/selenium-server-standalone-2.53.0.jar",
    "log_path" : "logs",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : 
{
      "webdriver.chrome.driver" : "bin/chromedriver.exe",
 "webdriver.ie.driver": "C:/PageObject/selenium-workspace/bin/IEDriverServer.exe"
    }
  },
 
    "test_settings" : 
    {
  
    "default" : 
      {
"launch_url" : "http://localhost",
"selenium_port"  : 4444,
"selenium_host"  : "localhost",
"silent": true,
"screenshots" : 
        {
"enabled" : false,
"path" : ""
   },
"desiredCapabilities": 
  {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true
  }
},
"ie": 
{
      "desiredCapabilities": 
 {
      "browserName": "internet explorer",
      "javascriptEnabled": true,
      "acceptSslCerts": true
  }
  },
 
 "chrome" : 
 {
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
 } ...
oneEnv.PNG
2 environments.PNG

Andrei Rusu

unread,
Jun 22, 2016, 4:37:08 AM6/22/16
to nightw...@googlegroups.com
At this point, this is not supported. It might be added in future
versions though. Feel free to open a feature request on GitHub.
> --
> You received this message because you are subscribed to the Google Groups
> "NightwatchJs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nightwatchjs...@googlegroups.com.
> To post to this group, send email to nightw...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nightwatchjs/df35f9b7-78f4-4338-83a9-b8827bc76ef9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

MakS

unread,
Jun 22, 2016, 10:04:15 AM6/22/16
to NightwatchJs
Thanks for the replay Andrei, I will open a feature request on GitHub.
However, I manage to accomplish something similar using different selenium ports. If someone is interested, i set the different environments to different selenium ports, and run all of the tests on each environment in parallel at the same time. With this i run tests on multiple instance of different environments in parallel, and the time for executing all tests on all environments was significantly shorten. 

Stratos Ioannidis

unread,
Apr 25, 2018, 4:34:27 AM4/25/18
to NightwatchJs
MakS, would be very interested to see how you accomplished that, got a config file to share?
Reply all
Reply to author
Forward
0 new messages