How to stop test case in catch block


so my question is if there is any possibility to stop running test case in the catch block without getting another error message.

Now I am simply using this:


It works, but the problem is that navigation to URL fails too and in html report of test suite it overrides the message on the top from original error produced in Try block of the code.

By message on the top I mean this:

Any suggestions?

So, I’m guessing you have something like this:

try {
  // Test steps
} catch(Exception e) {


Yeah, me too.

I think it’s possible but it would mean some Groovy metaprogramming (if it’s at a point where it can be hooked in). But I don’t know if that is possible right there - @kazurayam may know. And if it is, he’ll probably have a solution for us by tomorrow :sunglasses:

Oh, wait. Would a finally block help? Something like

boolean errorFlag = false

try {
  // Test steps
} catch(Exception e) {
  errorFlag = true
} finally {
  if(errorFlag) {
   // write errormessage and fail the test yourself

I don’t think that would work, but it may help move you forward…

Yes, looks feasible, but difficult to implement. … multiple layers of Closures passing the reference to the caller object to the delegate property inside the callee. …

Not by tomorrow.

I figured it would be a rats nest…

Metaprogramming without plan inevitably falls into mess.
I think I should not be metaprogramming-holic too much.


In the original post, you wrote:

What do you mean the original error?

What do you mean “Try block”? I ask this because in the snippet you showed


does not have any try{} block.

So I do not quite understand what you mean by saying “It works, but the problem is …”.

We’ve created an issue witch try-catch block:

Thanks @Russ_Thomas, and @kazurayam


does this mean,

  1. that the current behavior of Katalon Studio, according to which the parent test case (containing the callTestCase() command) of a failing child test case creates its own error, is not intended and will be changed?
  2. that in future the error occurring in the child test case (which was called by the callTestCase() command) can also be caught directly in the parent test case?

If this is the case, it would finally be the answer to my feature request here: Catch Root Cause Message for a failed Test Step even outside a Test Case
Besides, that would also make large parts of my code here superfluous: How to Highlight Test object in each and every step

I could reproduce this problem. Please have a look at my report at

  1. callTestCase will throw StepFailedException or StepErrorException if the child test case (callee) has errors.
    Current: the parent test case (caller) always fails even users catch the right exception.
    Next release: the parent test case should fail if users don’t catch the exception and should pass if uses catch the exception.
  2. Yes. In next releases, users can get the root cause exception of StepFailedException or StepErrorException like the below example:
try {
    WebUI.callTestCase(findTestCase('Callee'), [:], FailureHandling.STOP_ON_FAILURE)
} catch (StepFailedException e) {
	println e.getCause()
1 Like

Hi guys,

Please let us know if this issue has resolve in v6.0.5 or later

Yes, I checked it and found the issue was resolved. See the last section “Fixed? — yes”.

1 Like