How Do I Get the Top-Level / Parent Test Case Name at Runtime?

I have the following situation:

Given I can execute a Test Case individually or as part of a Test Suite or as part of a Test Collection
When I call some method to retrieve the top-level Test Case name
Then I get the top-level Test Case name

I have the following project structure:

Test Cases
    \---- My App 
            \---- Test    
                    |---- MA-1 Login Steps
                    \---- MA-2 Create Customer

The MA-2 Create Customer Test Case Calls MA-1 Login Steps

I would like to call some method similar to RunConfiguration.getExecutionSourceName(); inside of the MA-1 Login Steps to get the top-level test name.

This is to create a filename with the top-level test case name instead of the executing test case name for screenshots or log files at runtime.

Are there any quick solutions to this?

The following post might be interesting for you:

… I found you made a comment to this old post as well. Did you forget this?

3 Likes

@kazurayam Thanks, that solved it.

… I found you made a comment to this old post as well. Did you forget this?

Yes, I did make a comment back in 2019 and completely forgot about it :man_facepalming:
I did revisit that post but only read the title and thought it wasn’t relevant to my issue.

I have revised my previous post:

The revised post shows that you can get the parent TestCase’s id for a Test Case called by WebUI.callTestCase(xxx) keyword.