Use Listeners with callTestCase


Is it possible to use Listeners (@BeforeTestCase and @AfterTestCase) before and after WebUI.callTestCase(…) ?
Or at least, get TestCaseContext after the execution of WebUI.callTestCase ?

Thanks a lot,


I suppose you want to inform the callee Test Case of its name. For example, a caller Test Cases/Caller1 has this line:

WebUI.callTestCase(findTestCase("Test Cases/CalleeX",[:])

and a callee Test Cases/CalleeX has such line:

println "Hi, my name is ${testcaseName}"

Then you want see:

Hi, my name is CalleeX

The question is, how you can set the name of the callee test case ‘CalleeX’ into the variable testcaseName?

Am I right?

Thanks for your answer
Not exactly, but this is because my question is not clear.

My need is to have the “context” of the test case after its execution. For example, get its status.

To do something like :

TestCaseContext tcc = WebUI.callTestCase(…)

Because currently, I don’t have any information about the execution…


def result = WebUI.callTestCase(findTestCase(".../TCCallee"), ...)

Println result // ==> Something interesting


  // Do steps...

  return "Something interesting"

In short, a test case can return a simple value or even a more complex result, like a map, perhaps.

Thanks for your answer.

Solution found is to use GlobalVariable.


GlobalVariable.Gbl_TestCaseStatus = ‘Failed’
WebUI.callTestCase(findTestCase("…/TCCallee"), …)
// I use GlobalVariable.Gbl_TestCaseStatus here


// Some steps
// …
GlobalVariable.Gbl_TestCaseStatus = ‘Passed’ // ==> last line of the test case


I’m looking for you solution…
I have 1 “TestCase A” who called 3 Testcase (“TesCase A1”, “TestCaseA2” and “TestCaseA3”).
In each called TestCase in would like to have my first line code with : :

Mobile.comment('Entered in called test case = ’ + myCalledTestCase)

How to do that ?

If I use, the listener I can only get the “main” “TestCaseA” name.

Thank you for your help

The caller TestCaseA can pass the name of callees (though I find the following lines look unfit):

Mobile.callTestCase(findTestCase('TestCase A1'), ['calleeName': 'TestCase A1'])
Mobile.callTestCase(findTestCase('TestCase A2'), ['calleeName': 'TestCase A2'])
Mobile.callTestCase(findTestCase('TestCase A3'), ['calleeName': 'TestCase A3'])

and each callees (TestCase A1 and others) can consume the ‘calleeName’ argument.

Mobile.comment("Entered in called test case = ${calleeName}")

Yes, this solution is working, but…
… If one day I decide to change my “TestCaseA1” name… i have also to change it everywhere in code in my mains TestCases where it is called…

Thanks you


Tell me if I’m wrong but if you rename your test case name in Katalon Explorer (panel on the left), all dependencies like findTestCase(...) will be automatically updated with the new name.

However, about calleeName, correct, it will not be updated.
One solution to fix this problem is the following one (even if I agree that is not perfect).
Store all your TestCase name in GlobalVariables like :

  • TestCase1 = TestCaseA1
  • TestCase2 = TestCaseA2
  • TestCase3 = TestCaseA3

And use :
Mobile.callTestCase(findTestCase(GlobalVariable.TestCase1), ['calleeName': GlobalVariable.TestCase1])

By this way, you will have to change only the GlobalVariable value.