Katalon Analytics (beta) – Bringing new insights into test reports. Learn more!

KeywordUtil.markFailed method

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().

Example:

image

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.

Comments

  • Hi Marek,

    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.
  • Hi Hung,

    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)

    http://i.imgur.com/9XOGyqR.png

    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!
  • 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()
    log.logFailed("Failed 1")
    log.logFailed("Failed 2")
    log.logFailed("Failed 3")

    There are 3 FAILED level logs after execution. And that's it. :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!