Jeremy
Jeremy

Reputation: 1845

threading tests via test_workers with Nightwatch and Browserstack

Is it possible to run nightwatch test suites in parallel when running on Browserstack? I noticed this section of the Nightwatch + Browserstack docs stating that you should set it to false. By this, are they basically saying it's not possible? https://www.browserstack.com/automate/nightwatch-integration#running-first-test

Looking to add this to my Nightwatch config (which works fine locally - without Browserstack)

test_workers: {
  enabled: true,
  workers: 'auto',
},

Upvotes: 0

Views: 1252

Answers (1)

BountyHunter
BountyHunter

Reputation: 1411

Yes, you can certainly run parallel tests on BrowserStack. Here is a working configuration file I have been using to test in parallel on BrowserStack using Nightwatch

nightwatch_config = {
  src_folders : [ "tests/suite" ],

  selenium : {
    "start_process" : false,
    "host" : "hub-cloud.browserstack.com",
    "port" : 80
  },

  test_settings: {
    default: {
      desiredCapabilities: {
        'build': 'nightwatch-browserstack',
        'browserstack.user': process.env.BROWSERSTACK_USERNAME || 'BROWSERSTACK_USERNAME',
        'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACCESS_KEY',
        'browserstack.debug': true,
        'browser': 'chrome'
      }
    }
  },

  "test_workers": {
    "enabled": true,
    "workers": 10
  }   
};

// Code to copy seleniumhost/port into test settings
for(var i in nightwatch_config.test_settings){
  var config = nightwatch_config.test_settings[i];
  config['selenium_host'] = nightwatch_config.selenium.host;
  config['selenium_port'] = nightwatch_config.selenium.port;
}

module.exports = nightwatch_config;

Upvotes: 1

Related Questions