2017-08-02 110 views
0

我是soap和soapui的新手,我试图创建一个测试用例,我将发送相同的请求(XML附件)多次(约500),问题是每次我需要增加/更改请求中的值(id)。
因此,我想知道如果是将这个参数传递给附加的XML文件的方式?或者如果有另一种方法来做测试用例。
预先感谢您
UPDATE
这里是XML文件的内容:其中包括在SOAP请求如何将参数传递给SOAPUI中的SOAP请求

<mod:sendMSG xmlns:mod="http://test.soap/service/model"> 
    <id>${#Project#parameter1}</id> 
    <date>2016-04-03T04:03:00</date> 
    <infos> 
     <firstName>AT </firstName> 
     <lastName>AT </lastName> 
     ...... 
    </infos> 
</mod:sendMSG> 

,如下图所示的屁股:
enter image description here

+0

请显示您想要增加的xml片段? – Rao

回答

1

测试步骤:

  1. Groovy脚本

  2. SOAP请求(禁用)

我禁用了SOAP请求,因为它运行一次,然后脚本已经循环请求X倍。

Groovy脚本:

int loops = 500; 

for (iter in 1..loops) { 

    //Overwrite the 'parameter1' property at project level 
    testRunner.testCase.testSuite.project.setPropertyValue("parameter1", iter.toString()) 

    //log.info("iter: " + testRunner.testCase.testSuite.project.getPropertyValue("parameter1")); 

    // Run the teststep named 'SOAP Request' 
    def testStep = testRunner.testCase.testSteps['SOAP Request']; 
    testStep.run(testRunner, context) 
} 

现在你应该可以运行你的测试用例。我建议以前保存你的项目,我在运行时遇到了SoapUI崩溃的问题。

+1

感谢您的回应,但有一个问题,我在上面给出的xml包含在请求中,因此'$ {#Project#parameter1}'不会被相应的值替换。请参阅更新 – aName

+0

不幸的是,我没有将文件附加到请求中的经验,希望其他人可以在这方面提供帮助。 为什么你必须从文件注入xml,它不能只是SoapUI中的一部分请求? – einaralex

+0

谢谢,但它需要发送xml文件,这就是为什么它附加到请求。 – aName

相关问题