Forum Discussion

pumpernickel's avatar
pumpernickel
Regular Visitor
6 years ago

Set a node value in all test step's requests of all test cases in a test suites

Hi to everyone,

 

this is the code for what I'm trying to do: set a node value in all test step's requests of all test cases in a test suite.

 

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def AlltestCases = testRunner.testCase.testSuite.project.testSuites[testRunner.testCase.testSuite.name] 0.upto(AlltestCases.getTestCaseCount()) { AlltestCases.getTestCaseList().each{ it.getTestStepList().each{ if(it.getClass()== com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep){ if(it.getName().toLowerCase().contains("verify")){ step = groovyUtils.getXmlHolder("${it.getName()}"+"#Request") step.setNodeValue("//*:Name/text()", "\$"+"{#TestSuite#NAME_ID}") step.updateProperty() } } } } }

This groovy script is in the first test case and I get an error (XmlException: Unexpected Element: CDATA) as soon as the script try to modify the same tag in the second test case. What did i do wrong?

No RepliesBe the first to reply