How to populate 'Reason' in Browserstack from Katalon Studio - logging

Hi :slight_smile:

We have an Enterprise account with yourselves and have followed the steps to integrate BrowserStack.

However we are unsure what the best way is to pull through the ‘Reason’ (logging). We would like to see Exceptions/ Stack Track to give our client as much info as possible at the time of execution.

The instructions we have followed are Run Katalon Studio tests with Automate | BrowserStack Docs

We have implemented this After hook in the Test Listener, which is pulling through the correct Status of Pass or Fail now.

   def sampleAfterTestCase(TestCaseContext testCaseContext) {
  		String status = testCaseContext.getTestCaseStatus();
  		def driver = DriverFactory.getWebDriver()
  		JavascriptExecutor jse = (JavascriptExecutor)driver;
  		jse.executeScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \""+status+"\", \"reason\": \"<reason>\"}}");

We also currently use the KeywordUtil Class and Methods to indicate a Status and log out any Exceptions. Example:
try {
KeywordUtil.markPassed("Element has been clicked: " + ObjectDesc)
} catch (Exception e) {
KeywordUtil.markFailedAndStop("Failed to click on element: " + ObjectDesc + e)

Our question is: What is the best solution to provide the ‘Reason’ in Browserstack? Would we need to create our own version of KeywordUtil type of Class to follow these instructions Log contextual information using console annotations for Automate | BrowserStack Docs | BrowserStack Docs in order for us to log to BrowserStack or do you suggest another way that we can still use the KeywordUtil Class?

Please advise :slight_smile:

How would your work be affected if this issue has not been resolved?

  1. I cannot continue my job and have to work on something else while awaiting your response

Windows 10 locally/ Windows 11 Browserstack
Katalon Studio Version - latest
Katalon Studio logs - not relevant

Hi Kate @kate.mallinson, thank you for asking. Given you paid for the Enterprise account, you can raise your issue to Customer Support here. They will provide a more professional answer relating to the BrowserStack Integration.

Hope you can find a solution!

1 Like