Steps to follow,
Note - Make sure you are executing tests on a valid BrowserStack remote URL and have set up custom execution capabilities with minimum details - project, build and browser version.
1.In Katalon, declare three variables in a profile file as below.
sessionid
as String
bsUserName
as String - Assign BrowserStack account login username [ use the same variable name ]
bsPassword
as String - Assign BrowserStack account login password [ use the same variable name ]
2.Insert below line of code in each Katalon test cases after 'Open Browser' step.
GlobalVariable.sessionid = CustomKeywords.'com.testwithhari.katalon.plugins.Browserstack.getCurrentTestRunSessionID'()
3.Copy and Paste below method in Listener Class.
@AfterTestCase
def sampleAfterTestCase(TestCaseContext testCaseContext) {
if(testCaseContext.getTestCaseStatus() != 'FAILED') {
CustomKeywords.'com.testwithhari.katalon.plugins.Browserstack.updateTestName'(GlobalVariable.sessionid, testCaseContext.getTestCaseId())
CustomKeywords.'com.testwithhari.katalon.plugins.Browserstack.updateTestStatusAndReason'(GlobalVariable.sessionid, "PASSED", "Testcase is PASSED")
}
else {
CustomKeywords.'com.testwithhari.katalon.plugins.Browserstack.updateTestName'(GlobalVariable.sessionid, testCaseContext.getTestCaseId())
CustomKeywords.'com.testwithhari.katalon.plugins.Browserstack.updateTestStatusAndReason'(GlobalVariable.sessionid, "Failed", "Testcase is FAILED")
}
}
4.Execute test cases from Katalon and check test names and statuses updated accordingly in BrowserStack
Visit Katalon Forum for Plugin related discussions.