Forum Discussion
SmartBear_Suppo
Alumni
12 years agoHi,
Adding assertions to Assertion TestSteps use a different flow as different classes are involved.
Please see the code below, maybe you can adjust it. It adds one Xpath Match assertion to the specified Assertion TestStep in your TestCase.
Regards,
Giscard
SmartBear Support
Adding assertions to Assertion TestSteps use a different flow as different classes are involved.
Please see the code below, maybe you can adjust it. It adds one Xpath Match assertion to the specified Assertion TestStep in your TestCase.
import com.eviware.soapui.config.AssertionEntryConfig
import com.eviware.soapui.impl.wsdl.teststeps.assertions.support.AssertionEntry
import com.eviware.soapui.config.AssertionTestStepConfig
def factoryinstance = AssertionTestStepConfig.Factory.newInstance()
def testStep = context.testCase.testSteps["Assertion TestStep"];
def source = context.testCase.testSteps["Test Request"];
def entry1 = new AssertionEntry(factoryinstance.insertNewEntry(0) , testStep.getTestStep() )
def parent = null
def entry = entry1.buildAssertionEntry("XPath Match", "Xpath", false, testStep, source, "Response",parent)
testStep.addAssertionEntry(entry)
Regards,
Giscard
SmartBear Support