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

**URL:** <https://forum.katalon.com/t/how-do-i-get-the-top-level-parent-test-case-name-at-runtime/92659>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [July 11, 2023, 4:49am UTC](https://forum.katalon.com/t/how-do-i-get-the-top-level-parent-test-case-name-at-runtime/92659 "2023-07-11T04:49:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason.tolotta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jason.tolotta/32/7687_2.png) [@jason.tolotta](https://forum.katalon.com/u/jason.tolotta)\
**Post date:** [July 11, 2023, 4:49am UTC](https://forum.katalon.com/t/how-do-i-get-the-top-level-parent-test-case-name-at-runtime/92659/1 "2023-07-11T04:49:35Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [July 11, 2023, 5:02am UTC](https://forum.katalon.com/t/how-do-i-get-the-top-level-parent-test-case-name-at-runtime/92659/2 "2023-07-11T05:02:54Z")

</div>

The following post might be interesting for you:

[http://forum.katalon.com/t/testcasestack-a-chain-of-test-case-ids-by-webui-calltestcase/18049](http://forum.katalon.com/t/testcasestack-a-chain-of-test-case-ids-by-webui-calltestcase/18049)

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

---

<div class="post-metadata">

**Author:** ![jason.tolotta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jason.tolotta/32/7687_2.png) [@jason.tolotta](https://forum.katalon.com/u/jason.tolotta)\
**Post date:** [July 11, 2023, 7:46am UTC](https://forum.katalon.com/t/how-do-i-get-the-top-level-parent-test-case-name-at-runtime/92659/3 "2023-07-11T07:46:39Z")

</div>

@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 🤦‍♂️  
I did revisit that post but only read the title and thought it wasn’t relevant to my issue.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [July 13, 2023, 1:05am UTC](https://forum.katalon.com/t/how-do-i-get-the-top-level-parent-test-case-name-at-runtime/92659/4 "2023-07-13T01:05:26Z")

</div>

I have revised my previous post:

[http://forum.katalon.com/t/testcasestack-a-chain-of-test-case-ids-by-webui-calltestcase/18049](http://forum.katalon.com/t/testcasestack-a-chain-of-test-case-ids-by-webui-calltestcase/18049)

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