I'm trying to figure out a way to get a list of (names) of just the failed test steps, currently the below code is giving me all the names
def TestCase = testRunner.getTestCase()
def StepList = TestCase.getTestStepList()
StepList.each
{
log.info (it.name)
}
Now I'm not sure how to move on from here and the get the failed status of each step in that list
You can use the follow approach: Get the assertion status of the testSteps, and then check if the status is FAILED, UNKNOWN or VALID. You can use the follow groovy code to do so:
Take in account that not all testSteps has assertionStatus (like for example groovy testStep, this is why I check the property in the code above).
This code can be used simply in a
groovy testStepor as atear down scriptfor your testCase.If you need a different approach to work for all testSteps instead of only for testSteps which has
assertionStatusproperties, you can use the follow code. However note that the first approach advantage is that if you want you can use it as a simplygroovy testStep, the alternative counterpart is that the follow script can only be used as atearDownScriptand can only works correctly with the whole test execution since theresultsare only available at this context:testStepResult is an instance of
com.eviware.soapui.model.testsuite.TestStepResultyou can take a look at api to get more info.Hope this helps,