Return value of failed test case is null


Operating System Windows 10

Katalon Studio Version

Steps to reproduce

Main script:

String cat = WebUI.callTestCase(findTestCase('test1'), [:], FailureHandling.CONTINUE_ON_FAILURE)


String	cat = "kitten"
println(cat + "!")
try {
catch (Unsaved) {
return cat


def testKeyword() {
println("This keyword is going to fail cause a browser isn't open")

Expected Behavior
I expect the console to spit out “kitten!” “This keyword is going to fail cause a browser isn’t open” “lol” “kitten”

Actual Behavior
You actually end up with “kitten!” “This keyword is going to fail cause a browser isn’t open” “lol” “null

I’ve read other threads about called test cases failing if a catch is triggered inside of it; I can work around that (I was surprised to see in my investigation that it’s failing if it contains a custom keyword, but not failing in simpler scenarios).
But the failed case is also failing to send its return value. For reasons that are long-winded, I really need to send some info back to my main script from a failed test case (more than just “this is why it failed”).

Can anyone think of a workaround?


That’s a bug, 100%.

If you’re seeing “lol” printed, there is no reason why return cat should not work.

Since you have the code at hand to play with, did you try adding a finally block?

// ...
catch (Unsaved) {
} finally {
  System.out.println('Trying finally...')
  cat = "kitten"
return cat


Looks like the finally block executes fine, same as the catch. (Except, of course, if I put return cat into those blocks, that sends back null regardless of where appears)

I think I’ll start restructuring my tests such that anything I need data out of isn’t inside a separate test case.