Forum Discussion

ritesh23487's avatar
ritesh23487
Occasional Contributor
8 years ago

Re: How to get the names of all the testcases under the testsuite using Groovy

Hi Depeche

 

Can i get a code snippet to fetch the status of the Test Step in a Test Case from a Test suite which has many Test Cases under it.

 

 

Thanks 

Ritesh 

1 Reply

  • KarelHusa's avatar
    KarelHusa
    Champion Level 3

    ritesh23487, you can check the following script:

     

     

    def tcResults = runner.getResults()
    tcResults.each {
    	def tcRunner = it
    	log.info "TestCase: " + tcRunner.getTestCase().getName()
    	tcRunner.getResults().each {
    		log.info "NAME:" + it.getTestStep().getName() + " STATUS:" + it.getStatus()
    	}
    }

    You can execute the script as a tear down script of your test suite (the runner object is an instance of TestSuiteRunner).

     

     

    Karel