Reputation: 8414
I use Katalon Studio for my test automation. It comes with an in-built script editor (Groovy).
So, I can use Groovy's power assert that gives me a nice and detailed output message when the assert fails.
However, some other non-technical (or less-technical) staff would like to run automated tests themselves. And their problem is they are unable to correctly interpret the fail message.
I know I can use assert expression1 : expression2
for printing the custom message, but I really prefer the power assert output.
Is there a way to have both custom message and power assert message?
Upvotes: 1
Views: 373
Reputation: 2683
You could just add the message as a String to your assertion:
assert "a custom message" && expression
Since a non-empty String is truthy in Groovy, the assertion will only fail –and produce output– if the expression is falsey + you'll get power assertion output from it.
Upvotes: 1