Forum Discussion

JanPot's avatar
JanPot
Occasional Contributor
7 years ago

How to know if a groovy step PASSED or FAILED ?

Hi,   I have some test cases with REST and Groovy steps, sometimes the Groovy steps fails (a red star icon). At the end of the test cases, I have a groovy script that creates a report with the pa...
  • JHunt's avatar
    7 years ago

    Hi Jan,

    You should use

     

    testRunner.getResults()

    For instance, in a TestCase Teardown script:

     

     

    Map resultOf = testRunner.getResults()
     .collectEntries { result ->  [ (result.testStep): result.status ] }
    
    def mystep = context.getTestCase().getTestStepByName("Some step")
    log.info resultOf[myStep]

    In the attached project is another TestCase Teardown example, and an example of how to get the results from a TestSuite Teardown script.