Create a keyword that can fails step

I had created a custom keyword, i would like that when it runs into a false statement it makes the step fails.

I saw that Keywords normally throws StepFailedException, but I would like to use the same pattern of the keywords of Katalon so I can set STOP, CONTINUE or OPTIONAL failure handling.

1 Like

Your keyword can throw StepFailedException using KeywordUtil class.

STOP → use KeywordUtil.markFailedAndStop(msg)
CONTINUE → use KeywordUtil.markFailed(msg)
OPTIONAL → use KeywordUtil.markWarning(msg) or just KeywordUtil.logInfo(msg)