Integrate your Selenium test suite with Buildkite
A step-by-step guide to help you integrate Buildkite with the BrowserStack device cloud for running all your Selenium tests on BrowserStack Automate.
Buildkite is a continuous integration (CI) tool for running automated builds on your own infrastructure. It supports parallel and distributed builds, which speed up your building and testing processes by running multiple jobs at once.
BrowserStack Automate supports your existing Buildkite pipeline setup for running automated tests. To run your tests on BrowserStack, you can use the pipelines.yml
of the Buildkite pipeline.
Prerequisites
Before you begin, ensure that:
- You have a valid Buildkite account.
- You have connected your GitHub repository to Buildkite. For more information, see GitHub.
- You have created a pipeline in Buildkite. For more information, see Create your own pipeline.
- You have set up the Buildkite agent. For more information, see How to install Buildkite Agent.
Configure environment variables
To run your tests, you must set your BrowserStack username and access key as your environment variable. To do this:
In your Buildkite pipeline, go to Settings > Steps > Environment Variables.
Set the environment variable with your BrowserStack User Name and AccessKey.
To fetch your credentials, go to the BrowserStack Automation dashboard. Click ACCESS KEY. You can see your User Name and Access Key.
You can now read these variables in your tests.
You can skip this step if the Buildkite agent has the BrowserStack credentials set at the OS level or via system variables.
Integrate test cases for locally hosted websites
If you are testing websites hosted locally as part of your testing or development environment, configure your pipeline.yml
file to use the BrowserStack Local binary and route your tests through the local server.
Enable Local Testing
If you prefer to manage the Local connection through the BrowserStack SDK you can add the capability in the browserstack.yml
file.
If you chose to use BrowserStack Local binary as a way to establish a local connection, in the Buildkite pipeline.yml
file you must configure pipeline to automatically download and start the binary.
Edit your existing Buildkite pipeline.yml
file to include the code in the following snippets.
# For Linux-based systems, add the following commands in the given console to download the binary, run it, and stop its execution after the test has been executed.
- wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
- unzip BrowserStackLocal-linux-x64.zip
- ./BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY --daemon start
- <your-test-command>
- ./BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY --daemon stop
# For macOS-based systems, add the following commands in the given console to download the binary, run it, and stop its execution after the test has been executed.
- wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-darwin-x64.zip"
- unzip BrowserStackLocal-darwin-x64.zip
- ./BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY --daemon start
- <your-test-command>
- ./BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY --daemon stop
# For Windows-based systems, add the following commands in the given console to download the binary, run it, and stop its execution after the test has been executed.
- wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-win32.zip"
- powershell.exe Expand-Archive BrowserStackLocal-win32.zip
- ./BrowserStackLocal-win32/BrowserStackLocal.exe --key %BROWSERSTACK_ACCESS_KEY% --daemon start
- <your-test-command>
- ./BrowserStackLocal-win32/BrowserStackLocal.exe --key %BROWSERSTACK_ACCESS_KEY% --daemon stop
If you prefer to manage the Local connection through your test scripts, you can use the language bindings.
Check out enabling Local testing using language bindings to edit your test scripts.
Apart from these configurations, you can set other Local options, such as, testing behind a proxy, folder testing, or using multiple local instances. Check out Introduction to Local Testing for more information.
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!