Looking to test on every commit or PR? Introducing plans for high-scale testing on Chrome and Firefox. Read more

Run Tests in Parallel

Run multiple Ruby Cucumber tests in parallel on BrowserStack Automate

Note: Code samples in this guide can be found in the cucumber-browserstack sample repo on GitHub

On BrowserStack, you can run multiple Cucumber tests at the same time across various browser, device and OS combinations. This is called Parallel Testing. Parallel Testing gives you the same benefits as running a multi-threaded application.

With Parallel Testing, you can run the same test on different browser/device combinations i.e. cross-browser testing, or run different tests on the same or different browser/device combinations. Parallel Testing will help you reduce the run time of your test suite, resulting in faster build times and faster releases.

Run sample test in parallel

  1. Clone the cucumber-ruby-browserstack sample repo on GitHub using the following command:

    git clone https://github.com/browserstack/cucumber-ruby-browserstack.git
    cd cucumber-ruby-browserstack
    
  2. Install browserstack-automate to run your Cucumber tests on BrowserStack.

     gem install browserstack-automate
    
  3. Add browserstack-automate to your cucumber-ruby-browserstack/features/support/env.rb file:

     require 'browserstack-automate'
     BrowserStack.for "cucumber"
    
  4. Add the parallel_tests gem in your cucumber-ruby-browserstack/Gemfile file:

     gem 'parallel_tests'
    
  5. To run parallel tests use parallel_cucumber and add the option -n to specify the number of parallel processes as shown in the following command:

     parallel_cucumber BS_USERNAME=YOUR_USERNAME BS_AUTHKEY=YOUR_ACCESS_KEY BS_AUTOMATE_OS=Windows BS_AUTOMATE_OS_VERSION=<os-version> SELENIUM_BROWSER=<browser-name> -n 5
    

    In the above example, Chrome on Windows 10 has been used with 5 parallel processes.

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
Talk to an Expert