Hello, when I use KeywordUtil.markFailed() method, it shows only first fail in execution log. I am wondering if it is possible to log FAILED message each time I call markFailed().
Only first occurrence of markFailed() can be seen. It’s hard to determine in long tests how many markFailed() methods were invoked. How can I solve such a case? Thank you.
I believe I found a solution for such a problem. There is a class called KeywordLogger, which can write into a log. So just create an instance of it and call logFailed() method.
KeywordLogger log = new KeywordLogger()
There are 3 FAILED level logs after execution. And that’s it.
yes, I have set up FailureHandling as Continue on failure, so the test case would finish even when there is some failure. I used markFailed on purpose, because there is also markFailedAndStop method, which makes the test stop immediately.
Even this sample test has finished. Please see whole log: (sorry, img tag suddenly stopped working here)
All markFailed methods were invoked, but only Failed 1 message is shown in a log. I’d like to view all 3 messages, this is my original question. Thanks!
Unfortunately, the test case is stopped immediately when you call markFailed method. That’s why you only see the first failed step in the Log Viewer.
Katalon Studio provides “Failure Handling” settings for keywords, which allow users to decide to continue running when errors occur during execution. Please have a look here for better understanding. With regards to markFailed method, we should only use this method in a Custom Keyword to mark a keyword failed when it doesn’t meet your expectation.
Hope my answer can solve your concern.