Skip to main content

Handle Multiple Config Files in Automate

How to handle multiple config files in BrowserStack SDK?

The BrowserStack SDK enables you to maintain different configurations for different projects or folders within your test suites, by supporting multiple config files. This means, you can specify different platforms and capabilities for different tests, without having to update a single config file for the entire suite.
You can specify which config file is to be used using any one of the following methods:

Using CLI args

To use a specific config file with CLI args, simply add the browserstack.config flag followed by the path(relative/absolute) to the desired config file in the run command.

Framework Prefix Example command
Java -D mvn test -P sample-test -Dbrowserstack.config="customConfig.yml"
NodeJS – – npm run sample-test -- --browserstack.config "customConfig.yml"
npm run sample-test -- --browserstack.config="customConfig.yml"
Python browserstack-sdk python ./tests/test.py --browserstack.config "customConfig.yml"
C# dotnet browserstack-sdk --browserstack.config "customConfig.yml"

Using Environment Variables

To use a specific config file with environment variables, set the BROWSERSTACK_CONFIG_FILE variable to the path(relative/absolute) of the desired config file.

OS Set env variable Set env variable in a single command
MacOS/Linux export BROWSERSTACK_CONFIG_FILE="customConfig.yml" BROWSERSTACK_CONFIG_FILE="customConfig.yml" <your-test-command>
Windows Powershell $env:BROWSERSTACK_CONFIG_FILE "customConfig.yml" $env:BROWSERSTACK_CONFIG_FILE="customConfig.yml"; <YOUR_TEST_COMMAND>
Windows cmd set BROWSERSTACK_CONFIG_FILE "customConfig.yml" set BROWSERSTACK_CONFIG_FILE="customConfig.yml"&& <YOUR_TEST_COMMAND>

Note that CLI arguments take precedence over ENV variables.

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