cod
cod

Reputation: 151

Browser Stack , replacing session name with class or test Name

I using TestNG to run parallel test execution on browser stack.

On Browserstack json config file I had declared all code needed .

Is it possible to pass custom name for each session when executed parallel

Here is my config file

{
  "server": "hub-cloud.browserstack.com",
  "user": "username",
  "key": "user",

  "capabilities": {
    "build": "Client Side",
    "name": "Test"
    "browserstack.debug": true
  },

  "environments": {
    "chrome": {
      "browser": "chrome"
    },
    "firefox": {
      "browser": "firefox"
    },
    "safari": {
      "browser": "safari"
    },
    "ie": {
      "browser": "internet explorer"
    }
  }
}

For each test class inside package On Browserstack Automate Dashboard it shows Test Test Test , where as I am executing all classes inside package.

Can we pass custom name for each classes inside Build.

Upvotes: 4

Views: 3216

Answers (2)

Shyamjeet Sharma
Shyamjeet Sharma

Reputation: 26

Nunit use below :

capabilities.SetCapability("name", TestContext.CurrentContext.Test.MethodName);

before creating BrowserStack browser it is working for me, for other project checks, how we can SetCapability.

Upvotes: 0

Ömer Faruk Aplak
Ömer Faruk Aplak

Reputation: 911

You can use beforeSession.

ex:
beforeSession: function (config, capabilities, specs) { capabilities.name = specs && specs[0].split('/').pop() || undefined; }

Upvotes: 1

Related Questions