Skip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflow’s been missing. Explore now!
No Result Found
Connect & Get help from 6000+ developers on our Discord community. Ask the CommunityAsk the Community

Integrate your test suite with BrowserStack

BrowserStack supports a plug-and-play integration. Run your entire test suite in parallel in a few steps!

Prerequisites

Before you begin, ensure you have:

  • Ruby v3.0 or higher
  • RSpec 3.x or higher
  • Cucumber 6.x or higher
  • Selenium WebDriver 3.x or 4.x

Integration steps

Install the BrowserStack Ruby SDK

Add the BrowserStack SDK to your Gemfile and install the dependencies:

Open your Gemfile and add the BrowserStack Ruby SDK dependency.

Gemfile
Copy icon Copy

From your project root, install the bundle so Ruby picks up the new dependency.

Install dependencies
Copy icon Copy

Configure browserstack.yml

Create a browserstack.yml file in your project root to store BrowserStack credentials, target platforms, and feature flags:

Use a configuration similar to the following:

browserstack.yml
Copy icon Copy

Integrate the SDK with your test framework

Hook the BrowserStack Ruby SDK into your RSpec and Cucumber test lifecycles so it can capture and report test execution:

For RSpec, ensure your spec_helper.rb or rails_helper.rb requires the SDK:

spec_helper.rb or rails_helper.rb
Copy icon Copy

For Cucumber, require the SDK in features/support/env.rb so it can track scenarios and steps:

features/support/env.rb
Copy icon Copy

Run your test suite

Run your tests with the following commands. The BrowserStack SDK intercepts Selenium WebDriver sessions and routes them to BrowserStack:

To run your RSpec suite with BrowserStack integration enabled, run RSpec as you normally do:

Run RSpec tests
Copy icon Copy

To run your Cucumber scenarios, use the BrowserStack SDK wrapper so that the SDK can intercept sessions and send results to BrowserStack:

Run Cucumber tests
Copy icon Copy

After the run completes, review your sessions, accessibility scans, and observability data in the BrowserStack dashboard.

Advanced features and use cases

Here’s a list of features and capabilities you may find useful.

Accept insecure certificates

The acceptInsecureCerts capability suppresses browser popups warning about self-signed certificates usually found in staging environments.

Capability Expected values
acceptInsecureCerts A boolean. Default is False.
True if you want to accept all SSL certificates.
browserstack.yml

Change desktop resolution

The resolution capability changes the default desktop screen resolution for your tests on BrowserStack.

Capability Description Expected values
resolution Set the resolution of your VM before beginning your test A string. Default resolution is 1024x768

Supported resolutions:
Windows (XP, 7): 800x600, 1024x768, 1280x800, 1280x1024, 1366x768, 1440x900, 1680x1050, 1600x1200, 1920x1200, 1920x1080, and 2048x1536

Windows (8, 8.1, 10): 1024x768, 1280x800, 1280x1024, 1366x768, 1440x900, 1680x1050, 1600x1200, 1920x1200, 1920x1080, and 2048x1536

OS X (Sequoia, Sonoma, Ventura, Monterey, Big Sur, Catalina, Mojave, and High Sierra): 1024x768, 1280x960, 1280x1024, 1600x1200, 1920x1080, 2560x1440, 2560x1600, and 3840x2160

OS X (All other versions): 1024x768, 1280x960, 1280x1024, 1600x1200, and 1920x1080
browserstack.yml

Simulate IP geolocation

The geoLocation capability lets you test your websites across different countries.

Note that this capability is supported on the Enterprise plan only. You can contact sales to get an Enterprise plan for your account.

Capability Description Expected values
geoLocation Set the country code you want your test to detect A string. An ISO 2 country code

FR for France,
CN for China

Check out the complete list of 45+ countries we support.
browserstack.yml

Simulate network conditions

The networkProfile capability lets you test your websites under different network conditions.

Capability Description Expected values
networkProfile Set the network profile to start the test with A string.

2g-gprs-good, 4g-lte-advanced-lossy

Check out the complete list of all pre-defined network profiles.
browserstack.yml

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