I’ve got a custom keyword and if it doesn’t manage to do what it’s designed to, it throws an exception.
Now I’ve got cases where I want to test that it doesn’t work, but don’t want to write opposite keywords for all my keywords (more maintenance and more clunk!)
So I tried to catch my exception, and the test carries on as expected.
However, the test is marked as failed overall. I don’t want this. How do I solve this problem?
Hey Russ,
These aren’t applicable for my current scenario. My keyword is expecting to fail, but if I put a markPassed in there, then it wouldn’t fail for when I don’t wrap it in a try catch
I don’t like the way Katalon deals with this (and conditionals in general), it forces you to work a certain way (the wrong way imo).
I too had the same problem. In the end, I rewrote code so that I only had try/catch statements when I wanted a failure. If there is a better way, I couldn’t figure it out, and I’ve resigned myself to doing things the Katalon way.
If you know at the call site that you WANT it to fail, can’t you supply an optional boolean to the method so that it knows the kind of error handling you want/don’t want?
Cheers for the ideas guys! I think I might have to go with the boolean approach. Will have to update all tests which use these keywords which is going to be fun. Haha