如何比较SoapUI中两种方法的响应

时间:2017-05-26 11:32:07

标签: soap groovy soapui

我正在SopaUI免费版本的两个环境(Dev和UAT)上执行SOPA方法,并希望比较检查数据不匹配的响应,请为此建议任何解决方案。

响应格式 -

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetAccountsResponse xmlns="http://services.multichoice.co.za/SelfCare">
         <GetAccountsResult xmlns:a="http://datacontracts.multichoice.co.za/SelfCare" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:Account>
               <a:afterDue121To150>0</a:afterDue121To150>
               <a:afterDue151To180>0</a:afterDue151To180>
               <a:afterDue180UpField>0</a:afterDue180UpField>
               <a:afterDue1To30Field>0</a:afterDue1To30Field>
               <a:afterDue31To60Field>0</a:afterDue31To60Field>
               <a:afterDue61To90Field>0</a:afterDue61To90Field>
               <a:afterDue91To120Field>0</a:afterDue91To120Field>
               <a:currency>NGN</a:currency>
               <a:currentAmount>0</a:currentAmount>
               <a:defaultCurrencytotalBalance>0</a:defaultCurrencytotalBalance>
               <a:defaultCuurencyCode>NGN</a:defaultCuurencyCode>
               <a:invoicePeriod>1</a:invoicePeriod>
               <a:isPrimary>true</a:isPrimary>
               <a:lastInvoiceAmount>0</a:lastInvoiceAmount>
               <a:lastInvoiceDate>2017-02-19T15:52:54</a:lastInvoiceDate>
               <a:methodOfPayment>Cash</a:methodOfPayment>
               <a:number>3112</a:number>
               <a:paymentDueDate>2016-11-10T00:00:00</a:paymentDueDate>
               <a:segmentation>Customer Segment N</a:segmentation>
               <a:status>Suspended</a:status>
               <a:totalBalance>0</a:totalBalance>
               <a:type>Ges</a:type>
            </a:Account>
         </GetAccountsResult>
      </GetAccountsResponse>
   </s:Body>
</s:Envelope>

1 个答案:

答案 0 :(得分:0)

//步骤1:使用ReqProps = testRunner.testCase.getTestStepByName("stepname as in soapui suite" ReqProps.setPropertyValue("Endpoint","https://dev:endpoint")在soap请求中设置DEV环境 //步骤2:运行DEV步骤并将响应保存在某个变量testRunner.runTestStepByName("stepname as in soapui suite") DEvResponse = ReqProps.getPropertyValue("Response")

//步骤3:对UAT环境重复相同步骤,并在变量UATResponse中进行响应 //步骤4:使用`DetailedDiff diffInRes = new DetailedDiff(new Diff(DEVRes,UATRes))比较2个响应

列出differenceArray = diffInRes.getAllDifferences()`

//第5步。获取数组大小以验证XML是否匹配。如果XML不匹配,您可以打印差异并从数组中获得所有不匹配&#34; differencesArray&#34;