1
我正在使用免費的soap-ui版本。 對於基本的添加操作(計算器WSDL),我使用groovy從文本文件提供輸入,並且我想保存它的響應。我現在用在soapui中捕獲對文本或excel文件的響應
Groovy腳本是:
nextLine=context.fileReader.readLine()
def inputFileResponse = new File("D://file.txt")
if(nextLine!=null){
String[] inpData=nextLine.split(",")
testRunner.testCase.testSteps["Properties"].setPropertyValue("num1",inpData[0])
testRunner.testCase.testSteps["Properties"].setPropertyValue("num2",inpData[1])
inputFileResponse.write(context.testCase.testSteps["Add - Request 1"].getProperty("response").value)
testRunner.gotoStep(0)
}
問題區域:
1.Now這是給我完整的XML響應。但我只想獲得nodevalue「AddResult」,我想將它保存在一個文件中。
- 出的4個輸入它僅捕獲.I想捕捉每個響應最後一個輸入的響應。
1)高清響應= context.expand( '$ {添加 - 請求1#迴應#// * AddResult /文()}') inputFileResponse.append(響應),我試了一下像這樣,但它沒有捕獲任何東西。 – shiv
2)Thankyou,它解決了,但有一個問題,我已經使用** if(nextLine!= null)來循環(因爲它是逐行讀取文本文件中的數據)**,由於它是**不寫最後的迴應**,所以我應該寫哪個條件,以便它捕獲最後的迴應。 – shiv