Skip to main content

Manage multiple connections

You can test multiple forks and builds at the same time by setting up separate Local Testing connections for each. To do so, establish Local Testing connections using one of two ways:

Via language bindings:

Add the following snippet to your test scripts:

bs_local_args = { "key" => "YOUR_ACCESS_KEY" , "localIdentifier" => "randomstring"}
bsLocalArgs.put("localIdentifier", "Test123");
bs_local_args = { "key": "YOUR_ACCESS_KEY" , "localIdentifier": "randomstring"}
bs_local_args = { 'key': 'YOUR_ACCESS_KEY', 'localIdentifier': 'randomstring' }
bsLocalArgs.Add(new KeyValuePair("localIdentifier", "randomstring"));
$bs_local_args = array("key" => "YOUR_ACCESS_KEY", "localIdentifier" => "randomstring");

Via command-line interface

Establish each Local Testing connection using the –local-identifier flag, along with a unique connection name (for instance, Test 123).

Note: Not using the –local-identifier flag (for each Local Testing connection) will cut off the existing connection and create a new one.

./BrowserStackLocal --key YOUR_ACCESS_KEY --local-identifier
BrowserStackLocal.exe --key YOUR_ACCESS_KEY --local-identifier

After establishing Local Testing connections, configure the test script to run through a specific connection. To do so, set the browserstack.localIdentifier capability in your test scripts and add the unique connection name as parameter.

desired_caps = {
    'browserstack.local': 'true',
    'browserstack.localIdentifier': 'Test123'
}
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.local", "true");
desiredCapabilities.setCapability("browserstack.localIdentifier", "true");
desired_cap = {
	'browserstack.local': 'true',
	'browserstack.localIdentifier': 'true'
}
var capabilities = {
	'browserstack.local': 'true',
	'browserstack.localIdentifier': 'true'
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browserstack.local", "true");
capability.SetCapability("browserstack.localIdentifier", "true");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("browserstack.local", "true");
$capabilities->setCapability("browserstack.localIdentifier", "true");

Managing multiple Local Testing connections

You can use the [Local Testing API](https://www.browserstack.com/local-testing/api) to check the status of (or disconnect) active binaries. However, your connections will not show up in the API response unless you establish them using `--enable-logging-for-api` flag, as follows: ```bash ./BrowserStackLocal --key YOUR_ACCESS_KEY --enable-logging-for-api ```

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