Set name for Browserstack session

How can I set test case as session name in Browserstack

Hi,
I have done it this way (you might want to exclude the Test Suite name I’ve added). Create a BeforeTestCase listener:

@BeforeTestCase
def getCurrentTestCaseId(TestCaseContext testCaseContext) {
    GlobalVariable.currentTestCaseId = testCaseContext.getTestCaseId().substring(testCaseContext.getTestCaseId().lastIndexOf("/") + 1)
    KeywordUtil.logInfo("Current test case = " + testCaseContext.getTestCaseId().substring(testCaseContext.getTestCaseId().lastIndexOf("/") + 1))
}

@BeforeTestCase
def getRemoteTestCaseName() {
    def remoteRun = DriverFactory.getRemoteWebDriverServerType()
    boolean remote = (remoteRun != null)
    if (remote) {
        //setName of the sessionId to the testSuite-testCase that is being ran
        def nameVariable = GlobalVariable.currentTestSuiteId + "-" + GlobalVariable.currentTestCaseId
        RunConfiguration.setDriverPreferencesProperty("Remote", "name", nameVariable)
        //RunConfiguration.setWebDriverPreferencesProperty("name", GlobalVariable.currentTestSuiteId + "-" + GlobalVariable.currentTestCaseId)
        KeywordUtil.logInfo("Remote run. Speficied name = " + nameVariable)
    }
}

Hope this helps

Update: Oh yeah, I do believe this does require for you to have a parameter currentTestCaseId in your Profile (can be empty string value)

hi @kientuong2000,

Hello,

I updated the Browserstack Integration plugin last week.

If this is a feature that may interest you, I can integrate your request into the plugin.

Tell me if this is of value to you.

Plugin link : https://store.katalon.com/product/45/BrowserStack-Integration