希望将bankaTalimatNo参数传递给groovy脚本的以下请求。
我创建了一个名为bankaTalimatiNo的测试用例级属性。
在groovy脚本中,我迭代一个数组以正确设置值属性值,但生成的请求不会与属性值并行更改。
要实现这一点,正确的XML表达式应该是什么?
提前感谢
<soapenv:Header/>
<soapenv:Body>
<wso:kurumOdemesiSorgulaRequest>
<wso:bankaTalimatiNo>${Properties#bankaTalimatiNo}</wso:bankaTalimatiNo>
</wso:kurumOdemesiSorgulaRequest>
</soapenv:Body>
</soapenv:Envelope>
groovy脚本如下
project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName("maliye")
testSuite = project.getTestSuiteByName("TestSuite 1");
testCase = testSuite.getTestCaseByName("TestCase 1");
testStep=testCase.testSteps["SOAP Request1"]
File file = new File("C:/temp/test.txt")
file.write "This is the first line\n"
def String[] talimatNoArray = [
"3"
];
talimatNoArray.eachWithIndex{talimatNo, i->
testCase.setPropertyValue("bankaTalimatiNo" , "${talimatNo}");
log.info "aaa"+ testCase.getPropertyValue("bankaTalimatiNo");
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
context.bankaTalimatiNo=testStep.getPropertyValue("bankaTalimatiNo");
def responseHolder=testStep.getPropertyValue("response");
//Check if the response is not empty
assert responseHolder, 'Response is empty or null'
}
生成的请求始终相同,从不计算表达式
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:wso="http://maliye.yte.bilgem.tubitak.gov.tr/odeme/kurumodemesi/server/wso">
> <soapenv:Header/> <soapenv:Body>
> <wso:kurumOdemesiSorgulaRequest>
> <wso:bankaTalimatiNo>${bankaTalimatiNo}</wso:bankaTalimatiNo>
> </wso:kurumOdemesiSorgulaRequest> </soapenv:Body> </soapenv:Envelope>