callTestCase method doesn't update test case in Azure DevOps

I assumed that by using WS.callTestCase to call other Katalon Test Cases that each would update their corresponding Azure Test Case, but it looks like it’s just the one (main) Test Case that gets updated?

For example, let’s say I have a “MasterTestCase” Katalon Test Case, which uses callTestCase to run 5 other Katalon Test Cases, each integrated with an Azure Test Case ID. If I run the MasterTestCase, it will update the corresponding Azure Test Case, but NOT any of the five other Test Cases that it calls.

I don’t know all the terminology used by the devs, but I can explain in pseudo terminology why this might be the case – and, in so doing, suggest an improvement (which, if adopted, wouldn’t be quick to appear in the product).

It’s due to the execution model and architecture of the Katalon script execution code. callTestCase runs an execution stack inside the “master” Test Case. That means, in effect, the called TC behaves as a “method” wrapped by the master TC (and also how you retrieve any returned result).

Current execution model:

// in Master TC

def result = callTestCase(calledTC)

    // in calledTC
    // do steps
    return called_TC_result

// back in MasterTC

// do something with result

It would be better if there was a way to execute the Katalon runtime as a “shell”.

def result = KatalonShell.execute(TESTCASE_ID)

Test Case code running in the Katalon Shell wouldn’t necessarily know it wasn’t running as a normal Test Case. Everything would work as though it was a bona fide Test Case executing in Katalon (not a test case executing inside a test case). For example, @BeforeTestCase would execute correctly for all test cases:

  @BeforeTestCase
  def beforeTestCase(TestCaseContext testCaseContext) {
    comment("beforeTestCase: " + testCaseContext.testCaseId)
    // do stuff
    comment("beforeTestCase completed.")
  }

Even better, make KatalonShell support threaded operations so TCs could be executed asynchronously/in parallel, where applicable.

2 Likes