Forum Discussion

Sabitha_D's avatar
Sabitha_D
New Contributor
2 years ago

Smart Assertion Values capturing in Groovy

Hi Guys,

I am new to Ready API and still in learning phase . Currently , I am looking into the smart assertion , where in my smart assertion I am getting the error in a particular test step, I want to capture that Test step request - smart assertion response and display it in my HTM Report. Kindly let me know if there is anyway . 

[While googling I found a way for capturing it for all the test step in project , but dint find for selected test step and tried multiple times, still getting errors]

Thanks & Regards,

Sabitha D. 

2 Replies

  • AbbyS's avatar
    AbbyS
    New Contributor

    I want to capture the "Smart Assertion" response into a variable/property. Any ideas, how to achieve this!

    • AbbyS's avatar
      AbbyS
      New Contributor

      This worked for me:
      log.info "////////////////////////////////////////////////////////"
      testRunner.testCase.testSteps.each
      { name,props ->
      log.info "Test step name: $name"
      // check that the testStep class support assertions // (for example groovy testStep doesn't)
      if(props.metaClass.respondsTo(props, "getAssertionList"))
      {
      // get assertionList
      props.getAssertionList().each
      {
      // display the assertion Label Name - assertion Status - assertion Error Message
      log.info " $it.label - $it.status - $it.errors"
      }
      }
      }

      log.info "////////////////////////////////////////////////////////"

      >>> If you find the above solution useful then please give Kudos/Like to this message <<<