Forum Discussion

niravk17's avatar
niravk17
Occasional Contributor
8 years ago
Solved

getAssertionStatus() in readyapi

How do I can use getAssertionStatus()  for teardown script ..I have to log the status of all assertion for each test step ( considering unchecked "abort the test case if any error occur")

if any one come cross with this?

  • Hello niravk17

     

    The JavaDocs you are referring to are for TestServer. In SoapUI NG you should use other classes. The script to log the status of all the assertions should look like this:

     

    import com.eviware.soapui.model.testsuite.TestStep
    import com.eviware.soapui.model.testsuite.Assertable
    import com.eviware.soapui.model.testsuite.TestAssertion
    
    for (TestStep testStep : testCase.testStepList) {
    	if (testStep instanceof Assertable) {
    		for (TestAssertion assertion : testStep.assertionList) {
    			log.info testStep.name + " " + assertion.label + " " + assertion.status
    		}
    	}
    }

1 Reply

  • AntonE's avatar
    AntonE
    SmartBear Alumni (Retired)

    Hello niravk17

     

    The JavaDocs you are referring to are for TestServer. In SoapUI NG you should use other classes. The script to log the status of all the assertions should look like this:

     

    import com.eviware.soapui.model.testsuite.TestStep
    import com.eviware.soapui.model.testsuite.Assertable
    import com.eviware.soapui.model.testsuite.TestAssertion
    
    for (TestStep testStep : testCase.testStepList) {
    	if (testStep instanceof Assertable) {
    		for (TestAssertion assertion : testStep.assertionList) {
    			log.info testStep.name + " " + assertion.label + " " + assertion.status
    		}
    	}
    }