3

I need to run my all test cases in parallel of 4 different browser. On my chrome driver its work fine.

Problem arise when i try to run in parallel as local testing.

I get following error com.browserstack.local.LocalException: *** Error: Either another browserstack local client is running on your machine or some server is listening on port 45691

I am using TestNG as my test runner.

cod
  • 151
  • 4
  • 13
  • The error message indicates that you are launching multiple instances of BrowserStackLocal on the same machine. Since you are trying to initiate tests in parallel are also creating a separate local testing connection for each test run? – Mukesh Tiwari Mar 31 '17 at 12:31

3 Answers3

2

It is too late but maybe it is good for other developers.

I do not know in which language you are programming but if you are using java and using the browserstack-local-java which has poor documentation :(

You need to add browserstack.localIdentifier = "specific id" to the capabilities when you create the WebDriver

At the same time when creating the com.browserstack.local.Local which calls ./BrowserStackLocal under the hood you need to specify an option called localIdentifier and it must have the same value as the browserstack.localIdentifier.

This is not documented but I tested it and it works and take a look on https://github.com/webdriverio/webdriverio/issues/2252

Bakr
  • 31
  • 3
0

I had hard time solving the issue[Error: Either another browserstack local client is running on your machine or some server is listening on port 45691] when running parallel tests. So, I'm adding supporting details for those whore are using browserstack-local-java bindings.

Make sure you are using the correct key names in setting the local identifier for both Browserstack and Local connection.
String localIdentifier = "random string"; localConnectionOptions.put("localIdentifier", localIdentifier); bsCapabilities.setCapability("browserstack.localIdentifier", localIdentifier);

For more details, refer to the Browserstack documentation.

Gracie
  • 1
  • 1
0

Code to start browserstack local before start of test. I just use the current date-timestamp as my localIdentifier's value as it is unique every time i run it. I have the following bit code in my configuration file

 onPrepare: function (config, capabilities) {
    console.log("Connecting local");
    return new Promise(function (resolve, reject) {
      exports.bs_local = new browserstack.Local();
      exports.bs_local.start({ localIdentifier,'key': exports.config.key }, function (error) {
        if (error) return reject(error);

        console.log('Connected. Now testing...');

        resolve();
      });
    });
  },
Rich Rajah
  • 2,256
  • 1
  • 12
  • 14