Forum Discussion

kamahade's avatar
kamahade
Regular Contributor
15 years ago

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]");

No RepliesBe the first to reply