Forum Discussion

shyne's avatar
shyne
Occasional Contributor
10 months ago
Solved

Groovy - Get the name of the test case that called the "Run Test Case" for this test case

Get the name of the test case that called the "Run Test Case" for this test case in Groovy:   Test Suite: "ABC" has Test case "ABC123", which has a "Run Test Case" step, that runs "CommonTest1" ...
  • nmrao's avatar
    10 months ago

    shyne 

    Yes, got it.

     

    Here is the script needed:

     

    def showCallTrace = {
    	def step = context.'#CallingRunTestCaseStep#'
    	def myname = { it.name }
    	log.info "I am called by ${myname(step)} step of ${myname(step.parent)} test case of ${myname(step.parent.parent)} suite"
    }
    showCallTrace()