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