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

Run RSpec Tests in Parallel

On BrowserStack, you can run multiple RSpec tests at the same time across various browser, device, and OS combinations. This is “Parallel Testing”. Parallel Testing gives you the same benefits as running a multi-threaded application and helps you reduce the run time of your test suite, resulting in faster build times and faster releases.

To run tests on multiple browsers in parallel with RSpec on BrowserStack Automate, follow the below steps:

  1. Clone the rspec-browserstack repo on GitHub(if not already done):

     git clone https://github.com/browserstack/rspec-browserstack.git
     cd rspec-browserstack
    
  2. Install the dependencies using the following command (if not already done):

     bundle install
    
  3. Update parallel.config.yml file within the rspec-browserstack/config/ directory with your BrowserStack credentials 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-[Rspec] Parallel Test"
    
     browser_caps:
       -
         "browser": "chrome"
       -
         "browser": "firefox"
       -
         "browser": "internet explorer"
       -
         "browser": "safari"
    
  4. Capabilities for each environment can be customized. You can generate custom capabilities for your tests using our capability builder. For example:

    common_caps:
       "browserstack.debug": true
       "name": "Bstack-[Rspec] Parallel Test"
       "build": "My custom build name goes here"
       "resolution": "1920x1080"
    
     browser_caps:
       -
         "browser": "chrome"
         "browser_version": "latest"
         "os": "Windows"
         "os_version": "10"
       -
         "browser": "firefox"
         "browser_version": "latest-beta"
         "os": "Windows"
         "os_version": "10"
       -
         "device": "iPhone 12 Pro"
         "real_mobile": "true"
         "os": "iPhone"
       -
         "browser": "safari"
         "real_mobile": "true"
         "os": "Android"
    
  5. You can now run your tests in parallel on BrowserStack using the following command:

     bundle exec rake parallel
    
Note: Achieve your test coverage and build execution time goals by using our calculator to understand how many parallel sessions you need.

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