groovyguy
7 years agoCommunity Hero
Script Challenge - Assertions Statuses and Messages
Here's my contribution to the Script challenge issued, specifically for logging all of the assertions across a test suite.
import com.eviware.soapui.support.xml.XmlUtils; def p = context.testCase.testSuite.project; for(s in p.testSuiteList) { log.info("----------------------" + s.getLabel() + "------------------------"); for(c in s.testCaseList) { log.info("------" + c.getLabel() + "---------"); for(st in c.testStepList) { log.info("---" + st.getLabel() + "---"); if (st instanceof com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep) { log.info("-------------------------------------------------"); def assertions = st.getAssertionCount(); for (int i = 0; i < assertions; i++) { def assertion = st.getAssertionAt(i); log.info(assertion.getLabel() + " " + assertion.getStatus() + " " + assertion.getErrors()); } } } } }