Forum Discussion

nemowbray's avatar
nemowbray
New Contributor
4 years ago

Groovy script to run a Teststep doesn't fail when the test Step fails

Instead of copying and pasting test steps that I am using over and over in other test cases i decided to use a grovvy step to call the test step.  When one of the assertions fail on the step the grov...
  • nmrao's avatar
    nmrao
    4 years ago

    nemowbray 

    All you need is just a line in order to check if the particular test step us passed or not.

    Rremove every thing after line 10 of your script and add below line.

    Assuming that  the expected result is pass.

     

     

    assert tStep.run(testRunner, context).status.toString()  in ['OK', 'UNKNOWN'], ' Test step status does not match with the expected value'

     

     

     

    In case you are expecting tStep to be failed, the use below assertion

     

     

     

    assert tStep.run(testRunner, context).status.toString() == 'FAILED', 'Test step status does not match the expected result'