0

I have automation test suites that I execute in BrowserStack. The BrowserStack has pretty good selection of configuring capabilities including the name of the test. I figured out how to pass the name of test dynamically but this is not really enough. Is there any way to pass the short description? If this is not possible then maybe there is a way to insert a string into the text logs that also can be a test description. I am using: Java, TestNG, Maven, JSON. Thanks, everyone in advance.

1 Answers1

0

BrowserStack does not provide a direct option to add data (description) to the session logs on the Automate Dashboard. But, you can execute JavaScript to insert data (description) in the text logs.

In your test scripts you can use the following code snippet (in Java) where you wish to add the description:

JavascriptExecutor js = null;
        if (driver instanceof JavascriptExecutor)
            js = (JavascriptExecutor)driver;
        String scr="";
        scr="\"********STARTING: Simple Google Test\";";  // Add specific string here.
        js.executeScript(scr);

enter image description here

This should not affect your test runs.

  • Thanks a lot. But looks like this way doesn't really work. I am getting two issues after inserting text into logs using javascript: 1) if run multiple tests in parallel then only the first one that appears on Browserstack dashboard gets the text. 2) basically tests are doing nothing after inserting, cannot find any elements and fails in some time because of a timeout. – dancalif May 11 '17 at 16:36