Knowledge Base Article

Log all of the assertions across a test suite

Question

How to log all of the assertions across a test suite?

 

Answer

Here is a script demonstrating how to do this:

// Groovy
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());
					}
				}
			}
		}
	}
Published 4 years ago
Version 1.0
No CommentsBe the first to comment