vendredi 14 juin 2019

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

I'm trying to set a node value in all test step's requests xml of all test cases in a test suite.

The groovy script is in the first test case and I get an error (XmlException: Unexpected Element: CDATA) as soon as the script try to edit the same tag in the second test case.

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() 

             } 
          } 
       } 
    } 
  }

Aucun commentaire:

Enregistrer un commentaire