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:
After establishing Local Testing connections, configure the test script to run through a specific connection. Set the capability in your test scripts and add the unique connection name as parameter.
If you are using BrowserStack SDK, you can set the capabilities covered in this document within the browserstack.yml
file:
```yml
browserStackLocalOptions:
localIdentifier: randomstring
```
Copy icon
Copy
browserStackLocalOptions :
localIdentifier : randomstring
Add the following snippet to your test scripts:
capabilities = {
'bstack:options' = > {
"local" = > "true" ,
"localIdentifier" = > "randomstring" ,
} ,
}
Copy icon
Copy
DesiredCapabilities capabilities = new DesiredCapabilities ( ) ;
HashMap < String , Object > browserstackOptions = new HashMap < String , Object > ( ) ;
browserstackOptions. put ( "localIdentifier" , "randomstring" ) ;
Copy icon
Copy
desired_cap = {
'bstack:options' : {
"local" : "true" ,
"localIdentifier" : "randomstring" ,
} ,
}
Copy icon
Copy
var capabilities = {
'bstack:options' : {
"local" : "true" ,
"localIdentifier" : "randomstring" ,
} ,
}
Copy icon
Copy
AppiumOptions capabilities = new AppiumOptions ( ) ;
Dictionary< string , object > browserstackOptions = new Dictionary< string , object > ( ) ;
browserstackOptions. Add ( "local" , "true" ) ;
browserstackOptions. Add ( "localIdentifier" , "randomstring" ) ;
Copy icon
Copy
$caps = array (
'bstack:options' => array (
"local" => "true" ,
"localIdentifier" => "randomstring" ,
) ,
)
Copy icon
Copy
desired_caps = {
'browserstack.local' : 'true' ,
'browserstack.localIdentifier' : 'Test123'
}
Copy icon
Copy
DesiredCapabilities desiredCapabilities = new DesiredCapabilities ( ) ;
desiredCapabilities. setCapability ( "browserstack.local" , "true" ) ;
desiredCapabilities. setCapability ( "browserstack.localIdentifier" , "randomstring" ) ;
Copy icon
Copy
desired_cap = {
'browserstack.local' : 'true' ,
'browserstack.localIdentifier' : 'randomstring'
}
Copy icon
Copy
var capabilities = {
'browserstack.local' : 'true' ,
'browserstack.localIdentifier' : 'randomstring'
}
Copy icon
Copy
DesiredCapabilities capability = new DesiredCapabilities ( ) ;
capability. SetCapability ( "browserstack.local" , "true" ) ;
capability. SetCapability ( "browserstack.localIdentifier" , "randomstring" ) ;
Copy icon
Copy
$capabilities = new DesiredCapabilities ( ) ;
$capabilities -> setCapability ( "browserstack.local" , "true" ) ;
$capabilities -> setCapability ( "browserstack.localIdentifier" , "randomstring" ) ;
Copy icon
Copy
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
Copy icon
Copy
BrowserStackLocal.exe --key YOUR_ACCESS_KEY --local-identifier
Copy icon
Copy
Managing multiple Local Testing connections
You can use the 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:
./BrowserStackLocal --key YOUR_ACCESS_KEY --enable-logging-for-api < other_params>
Copy icon
Copy
Is this page helping you?
Thank you for your valuable feedback!