How to catch the test case error?

Hello,

I’m trying to get the error message with code.

So, I wrote that:

    try {
		    switch (testCaseName) {
		        case testCaseName:
					WebUI.callTestCase(findTestCase('tc_name'), param, FailureHandling.STOP_ON_FAILURE)
					testCaseStatus = 'Passed'
					break
		    }
		}
		catch(Exception e) {
			System.out.println('PRINT * ' + e)
			testCaseStatus = 'Failed'
		}

However, I got this message :

PRINT * com.kms.katalon.core.exception.StepFailedException: Unable to call Test Case ‘Test Cases/tc_name’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Call Test Case ‘Test Cases/tc_name’ failed)

Instead of:

Reason:
Assertion failed:
assert(true == false)
|
false

at tc_name.run(tc_name)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
...

Someone can help me ?

Thanks a lot!

Hi,

KeywordUtil log = new KeywordUtil()
https://api-docs.katalon.com/com/kms/katalon/core/util/KeywordUtil.html
log.markError(e)