Let me explain by example.
I have a Test Case which intentionally fails:
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.model.FailureHandling as FailureHandling
TestObject makeTestObject(String id, String xpath) {
TestObject tObj = new TestObject(id)
tObj.addProperty("xpath", ConditionType.EQUALS, xpath)
return tObj
}
WebUI.openBrowser('')
WebUI.navigateToUrl("http://demoaut.katalon.com")
WebUI.verifyElementPresent(makeTestObject("foo","//div[@id='bar']"), 3, FailureHandling.OPTIONAL)
WebUI.delay(1)
WebUI.closeBrowser()
When I ran this, I saw the following output in the console:
2024-08-03 20:29:08.252 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2024-08-03 20:29:08.256 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/SuppressedError
2024-08-03 20:29:08.893 DEBUG testcase.SuppressedError - 1: openBrowser("")
2024-08-03 20:29:09.346 INFO c.k.k.core.webui.driver.DriverFactory - Starting 'Chrome' driver
8月 03, 2024 8:29:09 午後 org.openqa.selenium.remote.DesiredCapabilities chrome
情報: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
2024-08-03 20:29:09.416 INFO c.k.k.core.webui.driver.DriverFactory - Action delay is set to 0 milliseconds
Starting ChromeDriver 126.0.6478.126 (d36ace6122e0a59570e258d82441395206d60e1c-refs/branch-heads/6478@{#1591}) on port 4620
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1722684553.192][WARNING]: This version of ChromeDriver has not been tested with Chrome version 127.
8月 03, 2024 8:29:13 午後 org.openqa.selenium.remote.ProtocolHandshake createSession
情報: Detected dialect: W3C
2024-08-03 20:29:13.666 INFO c.k.k.core.webui.driver.DriverFactory - sessionId = 67e90102633d1ea4bfa5d02a4f619d4a
2024-08-03 20:29:13.696 INFO c.k.k.core.webui.driver.DriverFactory - browser = Chrome 127.0.0.0
2024-08-03 20:29:13.711 INFO c.k.k.core.webui.driver.DriverFactory - platform = Mac OS X
2024-08-03 20:29:13.731 INFO c.k.k.core.webui.driver.DriverFactory - seleniumVersion = 3.141.59
2024-08-03 20:29:13.752 INFO c.k.k.core.webui.driver.DriverFactory - proxyInformation = ProxyInformation { proxyOption=NO_PROXY, proxyServerType=HTTP, username=, password=********, proxyServerAddress=, proxyServerPort=0, executionList="", isApplyToDesiredCapabilities=true }
2024-08-03 20:29:13.820 DEBUG testcase.SuppressedError - 2: navigateToUrl("http://demoaut.katalon.com")
2024-08-03 20:29:19.873 DEBUG testcase.SuppressedError - 3: verifyElementPresent(makeTestObject("foo", "//div[@id='bar']"), 3, OPTIONAL)
2024-08-03 20:29:19.917 DEBUG testcase.SuppressedError - 1: tObj = new com.kms.katalon.core.testobject.TestObject(id)
2024-08-03 20:29:19.960 DEBUG testcase.SuppressedError - 2: tObj.addProperty("xpath", EQUALS, xpath)
2024-08-03 20:29:19.989 DEBUG testcase.SuppressedError - 3: return tObj
2024-08-03 20:29:24.193 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: //div[@id='bar']'. Please recheck the objects properties to make sure the desired element is located.
2024-08-03 20:29:25.808 WARN c.k.k.core.keyword.internal.KeywordMain - com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'foo' located by '//div[@id='bar']' not found (Root cause: com.kms.katalon.core.exception.StepFailedException: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'foo' located by '//div[@id='bar']' not found
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword$_verifyElementPresent_closure1.doCall(VerifyElementPresentKeyword.groovy:85)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword$_verifyElementPresent_closure1.call(VerifyElementPresentKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword.verifyElementPresent(VerifyElementPresentKeyword.groovy:92)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword.execute(VerifyElementPresentKeyword.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyElementPresent(WebUiBuiltInKeywords.groovy:1448)
at SuppressedError.run(SuppressedError:15)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
at TempTestCase1722684541599.run(TempTestCase1722684541599.groovy:25)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
)
2024-08-03 20:29:25.822 DEBUG testcase.SuppressedError - 4: delay(1)
2024-08-03 20:29:26.932 DEBUG testcase.SuppressedError - 5: closeBrowser()
2024-08-03 20:29:27.301 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/SuppressedError
Now I would assume that @eric.fabiszewski want to suppress the 25 lines of stack trace, that is
2024-08-03 20:29:25.808 WARN c.k.k.core.keyword.internal.KeywordMain - com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'foo' located by '//div[@id='bar']' not found (Root cause: com.kms.katalon.core.exception.StepFailedException: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'foo' located by '//div[@id='bar']' not found
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword$_verifyElementPresent_closure1.doCall(VerifyElementPresentKeyword.groovy:85)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword$_verifyElementPresent_closure1.call(VerifyElementPresentKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword.verifyElementPresent(VerifyElementPresentKeyword.groovy:92)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementPresentKeyword.execute(VerifyElementPresentKeyword.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyElementPresent(WebUiBuiltInKeywords.groovy:1448)
at SuppressedError.run(SuppressedError:15)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
at TempTestCase1722684541599.run(TempTestCase1722684541599.groovy:25)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
)
Yes, it is possible to suppress this stack trace message. But how to?
ANSWER
In all Katalon project, you have a file Include/config/log.properties. In this file, you want to insert a line:
logging.level.com.kms.katalon.core.keyword.internal.KeywordMain=ERROR
This line specifies that the messages from com.kms.katalon.core.keyword.internal.KeywordMain of level lower than ERROR should be filtered out; won’ be printed to the console.
Accepted log level includes ERROR , WARN , INFO , DEBUG and TRACE .
With the log.properties file edited, you want to try the same Test Case. You would find that the verbose stack trace is not emmited any longer.
2024-08-03 20:34:29.401 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2024-08-03 20:34:29.409 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/SuppressedError
2024-08-03 20:34:30.118 DEBUG testcase.SuppressedError - 1: openBrowser("")
2024-08-03 20:34:30.534 INFO c.k.k.core.webui.driver.DriverFactory - Starting 'Chrome' driver
8月 03, 2024 8:34:30 午後 org.openqa.selenium.remote.DesiredCapabilities chrome
情報: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
2024-08-03 20:34:30.619 INFO c.k.k.core.webui.driver.DriverFactory - Action delay is set to 0 milliseconds
Starting ChromeDriver 126.0.6478.126 (d36ace6122e0a59570e258d82441395206d60e1c-refs/branch-heads/6478@{#1591}) on port 4144
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1722684874.588][WARNING]: This version of ChromeDriver has not been tested with Chrome version 127.
8月 03, 2024 8:34:34 午後 org.openqa.selenium.remote.ProtocolHandshake createSession
情報: Detected dialect: W3C
2024-08-03 20:34:35.021 INFO c.k.k.core.webui.driver.DriverFactory - sessionId = 9d0e62df38d9e435df0217ba0a6e335a
2024-08-03 20:34:35.130 INFO c.k.k.core.webui.driver.DriverFactory - browser = Chrome 127.0.0.0
2024-08-03 20:34:35.153 INFO c.k.k.core.webui.driver.DriverFactory - platform = Mac OS X
2024-08-03 20:34:35.180 INFO c.k.k.core.webui.driver.DriverFactory - seleniumVersion = 3.141.59
2024-08-03 20:34:35.195 INFO c.k.k.core.webui.driver.DriverFactory - proxyInformation = ProxyInformation { proxyOption=NO_PROXY, proxyServerType=HTTP, username=, password=********, proxyServerAddress=, proxyServerPort=0, executionList="", isApplyToDesiredCapabilities=true }
2024-08-03 20:34:35.248 DEBUG testcase.SuppressedError - 2: navigateToUrl("http://demoaut.katalon.com")
2024-08-03 20:34:41.239 DEBUG testcase.SuppressedError - 3: verifyElementPresent(makeTestObject("foo", "//div[@id='bar']"), 3, OPTIONAL)
2024-08-03 20:34:41.266 DEBUG testcase.SuppressedError - 1: tObj = new com.kms.katalon.core.testobject.TestObject(id)
2024-08-03 20:34:41.315 DEBUG testcase.SuppressedError - 2: tObj.addProperty("xpath", EQUALS, xpath)
2024-08-03 20:34:41.337 DEBUG testcase.SuppressedError - 3: return tObj
2024-08-03 20:34:45.602 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: //div[@id='bar']'. Please recheck the objects properties to make sure the desired element is located.
2024-08-03 20:34:47.317 DEBUG testcase.SuppressedError - 4: delay(1)
2024-08-03 20:34:48.380 DEBUG testcase.SuppressedError - 5: closeBrowser()
2024-08-03 20:34:48.766 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/SuppressedError