Forum Discussion

ashkht's avatar
ashkht
Contributor
7 years ago
Solved

How to get TestStep Status as Passed/Failed using groovy

Hello,   I am trying out a way which can give me TestStep Status as Failed/Passed using groovy so that based on this status i can update Pass/fail against test case in excel from where it is data d...
  • Nastya_Khovrina's avatar
    Nastya_Khovrina
    7 years ago

    You can get the status of individual assertions from the Assertion Test Step with the following script in the Groovy Test Step:

    def testStep = testRunner.testCase.getTestStepByName("Assertion") //change to your name
    def list = testStep.getAssertionEntryList()
     
    for( assertion in list)
    {
      //log.info(assertion.getProperties())
      log.info("Assertion: " + assertion)
      log.info("Assertion: " + assertion.status)
    }