Test Listener not working for internal call Test case method

Here is my scenario. I need to run a group of test cases to check my end to end scenario. I am using Test listener @BeforeTestCase to load the test data for respective test cases. My listener is calling the @BeforeTestCase only at the beginning of the main test case and not for the internally called test case. How can I do this setting?

Example Code: E2EVerifyAccounts test case

  1. WebUI.callTestCase(findTestCase(‘login’), , FailureHandling.STOP_ON_FAILURE)

Mobile._tap_(_findTestObject_('Accounts_Tab'), 5)
  1. WebUI.callTestCase(findTestCase(‘VerifyAccounts’), , FailureHandling.STOP_ON_FAILURE)

  2. WebUI.callTestCase(findTestCase(‘logout’), , FailureHandling.STOP_ON_FAILURE)

Note: We will be calling a group of end to end test case in my test suite

Hi Any updates on this? has anyone faced this scenario?

I don’t think it’s possible using the listener hooks. I think your best bet is to implement your own “hook” at the beginning of each internal test case. In pseudo code, something like:

if (data not present) {
  go get the data
}

Or, perhaps:

if (running as internal TC) {
  go get the data
}

Your @BeforeTestCase should possibly call the same “go get the data” method to ensure consistency.

thank you this helps… it was my plan B, it would be great to have this feature for the call test case as well.
I also wanted to know if there is any listener hooks for test step level ? I want to have a check if the data is present then execute the step, else skip the step type.

I also wanted to know if there is any listener hooks for test step level ?

No, I thought that was what you asked before – or did I misunderstand?

If you mean at each line in a test case, no, there is nothing in the standard Katalon framework to do that. There is the possibility to override the Groovy invokeMethod implementation but that’s pretty advanced stuff:

http://docs.groovy-lang.org/latest/html/documentation/#_invokemethod

Thank you Russ :slight_smile: yes my first question was for using @BeforeTestCase not invoked CallTestCase() i.e Testcase within test case and second question was like using listener at test step level like @BeforeTestStep.

I will have a look at the link you shared and explore :slight_smile: