How to sign the test case "failed" when I have fail in teardown section

Hello there,

I have a control function in the @tearDown section of the test cases.
(collecting/analyzing error messages from browser console log).
When this function will be failed (find an error/severe message), I can see it in the test case log, but my case will be success/green. I need some help how to sign “failed” the case, because
I have 600+ cases and I don’t want to open all cases log to know, how to end this teardown function.

You can call KeywordUtil#markFailed(message)

https://api-docs.katalon.com/com/kms/katalon/core/util/KeywordUtil.html

This will mark any Test Case as “failed”.

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

KeywordUtil.markFailed("I am sleepy")

markFailed will emit a verbose Java Stack Trace message in the console. If you do not like the verbosity but want to distinguish the test case from other successful ones, then you can use KeyworkUtil.markWarning(String)

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

KeywordUtil.markWarning("I am sleepy")

This will make a single line of message in the log viewr about the test case with yellow background color without StackTrace in the console.

You can read the source of the KeywordUtil here. By reading the source you woud understand what it does internally.

1 Like

@kazurayam


The problem also exists after using your advice.
My original function did it exactly same result.
The test case won’t be marked as error or failed but only the teardown section!
Anyway, thank you for your advice!

Well, the teardown event is too late to set the status of a testcase execution.

Why not you call this control function at the end of testcase body?

@kazurayam
Because I have approx. 600 testcases :smiley: I didn’t want to put this new function to all of them.
I see now, there isn’t other solution yet.