使用Groovy修改Soap UI请求 [英] Modifying Soap UI request using groovy
问题描述
我们需要查找当前国家/地区的经销商数量.在下面的xml请求中,键值对将针对每个请求而有所不同.对soap请求的输入将在.txt文件中给出.基于.txt文件中的输入数量,我需要动态生成键值对xml标签.
we have a requirement of finding the number of dealers in current country.In the below xml request key-value pair will be varied for every request. Inputs to the soap request will be given in .txt file.Based on the number of inputs in .txt file i need to generate key-value pair xml tags dynamically.
**Format of Input.txt**
1.key1=Fruit,value1=Carrot,Key2=Vegetable,value2=Carrot
2.key1=Vegetable,value1=Potato
3.key1=Fruit,value1=Apple,key2=Fruit,value2=Orange,key3=Fruit,value3=Mango
SoapUI请求
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET">
<soapenv:Header/>
<soapenv:Body>
<web:GetCitiesByCountry>
<web:CountryName>Ind</web:CountryName>
<web:queryParameters>
<web:key>Fruits</web:key>
<web:value>Mango</web:value>
</web:queryParameters>
<web:queryParameters>
<web:key>Vegetables</web:key>
<web:value>Carrot</web:value>
</web:queryParameters>
</web:GetCitiesByCountry>
</soapenv:Body>
</soapenv:Envelope>
推荐答案
这里有一些很好的技术解决方案,但是,如果您购买了SoapUI许可证,则可以访问数据驱动的测试功能,该功能完全可以完成您的工作想要开箱即用.不需要常规脚本.
There's some good technical solutions here, but if you buy a SoapUI license, you'll be able to access the data driven test functionality, which does exactly what you want right out of the box. No groovy scripts required.
这篇关于使用Groovy修改Soap UI请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!