Skip to main content
No Result Found

Running JS unit tests in parallel

Learn how to get faster feedback by running your JS unit tests in parallel.

The BrowserStack grid gives you the infrastructure you need to scale. Features like Parallel Testing and Queuing enable you to scale faster.

Parallel Testing

On BrowserStack, you can run multiple JS unit tests at the same time across various browser, device and OS combinations. This is what we refer to as Parallel Testing.

Parallel Testing gives you the same benefits as running a multi-threaded application helps you reduce the run time of your test suite, resulting in faster build times and faster releases.

You can either use on of the supported test runners to parallelize, or send API requests to the JS API in parallel by spawning multiple processes yourself.

For example, to run tests on multiple browsers in parallel on BrowserStack, modify the config file as below in case of karma-browserstack-launcher:

karma.conf.js
module.exports = function(config) {
  config.set({
    // global config of your BrowserStack account
    browserStack: {
      username: 'YOUR_USERNAME',
      accessKey: 'YOUR_ACCESS_KEY'
    },

    // define browsers
    customLaunchers: {
      bstack_firefox_mac: {
        base: 'BrowserStack',
        browser: 'Chrome',
        browser_version: '72.0',
        os: 'Windows',
        os_version: '10'
      },
      bstack_iphone5: {
        base: 'BrowserStack',
        device: 'iPhone 5',
        os: 'ios',
        os_version: '6.0'
      }
    },

    browsers: ['bstack_firefox_mac', 'bstack_iphone5']
  })
}

Queuing

With queuing, you can launch an additional number of parallel tests with different browser configurations that will be queued in a sequence. For instance, if you want to run 5 additional tests, apart from your subscribed limit of 2 parallel tests, BrowserStack will queue the additional 5 tests until one of the 2 initial tests finish, and a slot is available for execution. With queuing, you don’t need to worry about managing your test pipeline - we automatically take care of scheduling and execution for you.

With this feature, accounts up to 5 parallel tests can queue 5 tests. Beyond 5 parallel tests, an equivalent number of tests will be queued.

Warning: The wait limit for the execution of a pending queued job is 15 minutes and the test will be canceled if it is queued beyond this limit.

Next Steps

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle