Jenkins CI/CD with BrowserStack Load Testing
Integrate BrowserStack Load Testing into Jenkins Pipelines to run load tests and publish JUnit reports.
Overview
You can add BrowserStack Load Testing to your Jenkins Pipeline so that your CI/CD runs can download the BrowserStack CLI, execute a load test, and publish JUnit reports.
Prerequisites
Make sure you have the following before you start:
- A BrowserStack account with access to Load Testing.
- A Jenkins controller/agent setup where you can run scripted pipelines.
- BrowserStack credentials configured in Jenkins as environment variables. You can find the credentials on your account’s profile page:
BROWSERSTACK_USERNAMEBROWSERSTACK_ACCESS_KEY
You can find these values on the BrowserStack profile page at: https://www.browserstack.com/accounts/profile/details
- Use one of the following ways to set credentials in Jenkins:
- Global properties: Manage Jenkins > System > Global properties.
- Jenkins credentials (recommended): Store credentials and inject them into the pipeline.
- (Optional) AnsiColor plugin installed for colored console logs. If you do not use this plugin, remove the
ansiColor('xterm')option from the pipeline.
Jenkins pipeline script
The following Jenkins scripted pipeline downloads the BrowserStack CLI for the current agent OS, checks out the BrowserStack Playwright load-testing sample repository, runs a load test, and publishes JUnit XML reports:
Result
When this pipeline runs, it:
- Downloads the BrowserStack CLI for the current Jenkins agent OS and architecture.
- Checks out the BrowserStack Playwright load-testing sample repository.
- Runs a BrowserStack Load Testing job using your configured credentials.
- Publishes JUnit XML reports from the load test.
- Marks the build as failed if the load test fails.
Notes
- The pipeline supports Linux, macOS, and Windows agents through
isUnix()and PowerShell branches. - JUnit XML reports are published automatically using the
junitstep. - If you do not have the AnsiColor plugin installed, remove the
ansiColor('xterm')option from theoptionsblock.
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
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!