问题
Hi i am new to soapui and have this situation.I have two service memberservice1 where the response has "Region" property.I need to check this property and see if its value is "SCR" i need to modify it to "SCA" and pass it to another WS memberservice2.
I tried this way but couldnt get it.Can anyone please suggest.
def smlholder = groovyUtils.getXMLholder("Webservice#request");
def node = smlholder.getnodevalue("//region");
if(node == 'SCA')
testRunner.testcase.testSteps("anotherwebservicename").setProperty('Region','SCR');
回答1:
Your example code does not match you statement. Below I will follow your statement, and ignore the broken code example.
There are several different ways this cane be done. The easiest would probably be:
def region = context.expand("${Webservice#Response#//*:region}")
if (region == "SCR")
testRunner.testCase.testSteps["anotherwebservicename"].setProperty("Region", "SCA");
else
testRunner.testCase.testSteps["anotherwebservicename"].setProperty("Region", region);
来源:https://stackoverflow.com/questions/31192398/property-transfer-in-soapui-using-groovy-script