Run Capybara Tests in Parallel

Run multiple Capybara tests in parallel on BrowserStack Automate

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

On BrowserStack, you can run multiple Capybara 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 capybara-browserstack sample repo on GitHub, if not already done:

    git clone https://github.com/browserstack/capybara-browserstack.git
    cd capybara-browserstack
    
  2. Install the dependencies using bundle install
  3. Setup your credentials and browser/devices where you want to run your test, in the capybara-browserstack/config/parallel.config.yml file as shown below:

    parallel.config.yml
     server: "hub-cloud.browserstack.com"
     user: "YOUR_USERNAME"
     key: "YOUR_ACCESS_KEY"
    
     common_caps:
       "browserstack.debug": true
       "name": "Bstack-[Capybara] Parallel Test"
    
     browser_caps:
       -
         "browser": "chrome"
       -
         "browser": "firefox"
       -
         "browser": "internet explorer"
       -
         "browser": "safari"
    
  4. Run your tests in parallel on BrowserStack using following command:

     bundle exec rake parallel
    
  5. You can choose to add other capabilities under the browser_caps as shown below, to run you test on other environments:

    browser_caps:
       -
         "browser": "chrome"
         "browser_version": "latest"
         "os": "Windows"
         "os_version": "10"
       -
         "device": "iPhone 12 Pro"
         "browser": "iPhone"
         "os_version": "14"
       -
         "device": "Samsung Galaxy S20 Ultra"
         "browser": "Android"
         "os_version": "10.0"
       -
         "browser": "safari"
         "browser_version": "latest"
         "os": "OS X"
         "os_version": "Big Sur"
    
Note: You can use our capability builder and select from a wide range of custom capabilities that BrowserStack supports.

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