Show value in log viewer

I want to show value to log viewer. Anyone know how?

I have tried the class keywordutil.loginfo(“”) to show message on log viewer. But it doesn’t. It only show in message after running test suite.


I tried the KeywordLogger.logInfo(“”) but groovy can’t find the class

To use “keywordutil” you need the appropriate “import” statement. If you hit the 3-key combination, CTRL+SHIFT+O (oh), then the appropriate “import” statements will appear and those that are not used, will be deleted.

import com.kms.katalon.core.util.KeywordUtil as KeywordUtil

Another way to get text to display in the log viewer is to use:

WebUI.comment("your text here")

or

WebUI.comment("your text and ${myVariable} values")

Note the use of double quotes to surround your text and variables. You can use single quotes if you only have text.

Edit: And, information on KeywordLogger can be found here.

I tried the following in a new test case and get information printed to the Info Log as expected:
import com.kms.katalon.core.util.KeywordUtil

def myVariable=“String of text”
KeywordUtil.logInfo("Some new text: " + myVariable)

Is this running as part of a new test case or part of the Before/After the test case runs?

Oh my bad, I have found the message in child info inside of test step Keyword.logInfo when run single test case. It collapsed

1 Like