kamahade
15 years agoRegular Contributor
Setting Xpath assertion using API
People who want to add Xpath - Contains assertions using API.. can see this code sample/
import com.eviware.soapui.impl.wsdl.teststeps.*;
def teststep = testRunner.testCase.testSuite.getTestCaseByName("RefAddtnlTvMusicCode TestCase").getTestStepByName("RefAspectRatio")
teststep.addAssertion("XPath Match")
def assertion = teststep.getAssertionByName("XPath Match")
def responseAsXml = context.expand( '${RefAspectRatio#ResponseAsXml#//Response[1]}' )
assertion.setExpectedContent(responseAsXml);
assertion.setPath("//Response[1]");