Maximus
6 years agoNew Contributor
Pass variable from Groovy Script to request
Hi,
I have a test suite with a number of test steps: SOAP request -> Grtoovy Script -> Soap request. My groovy script parses the response from the previous request and then is supposed to pass some attribute to the next soap request, but it doesn't seem to be working correctly as the second soap request is failing. Below is the groovy script:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder( "getEnabled#Response" ) for(job in holder.getNodeValues("//identifier")){ if (job.contains("WS2")){ testRunner.testCase.testSteps["Disable"].setPropertyValue('ID', job2) testRunner.runTestStepByName("Disable") } }
I'm trying to pass the attribute 'ID' to the next soap request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prin="http://www.gmc.net/PrintNetPA"> <soapenv:Header/> <soapenv:Body> <prin:disable> <classname>input</classname> <identifier>${#TestCase#ID}</identifier> </prin:disable> </soapenv:Body> </soapenv:Envelope>
But this soap request is failing. Can anyone tell me where I'm going wrong please?