Search code examples
katalon-studio

How to get child test case pathname in Katalon Studio


If you're reading this question, chances are that you already know how to get pathname of a test case in Katalon Studio :

RunConfiguration.getExecutionSourceId()

However, that doesn't seem to work on child test cases. For example, in my case, I have some child test case, whose path is Test Cases/New Zoho/Member Lead/New Zoho - Member Lead, being called from parent test case Test Cases/New Zoho/New Zoho - 02 Create Practice. It is in a benchmark handler class, that create the benchmark file if it doesn't already exist, using the test case pathname.

The New Zoho - Member Lead test case has some code that ends up using RunConfiguration.getExecutionSourceId(). When I put debug breakpoint at that line, and run it, I see Test Cases/New Zoho/New Zoho - 02 Create Practice. and not the name of the child test case. It ends up creating New Zoho/New Zoho - 02 Create Practice.xlsx instead of appending to the already-existing New Zoho/Member Lead/New Zoho - Member Lead.xlsx in the benchmark data folder...

How do I get the child test case name here instead?


Solution

  • It looks like you can do something like this:

    RunConfiguration.getExecutionProperties().get("current_testcase")

    to get the id of the current test case context, even if that test case is a child test case...