如何在 SOAP UI 中 运行 多个请求并存储所有响应?
How to run multiple request in SOAP UI and Store all Response?
我在一个 folder.I 中有大约 100 个请求 运行 一个一个地处理所有请求,并且需要在 SOAP UI 中捕获所有请求的响应。
有人可以帮助我了解详情吗?
在这里,您可以通过两个步骤创建一个测试用例:
- Groovy 脚本步骤
- SOAP 请求步骤
Groovy 脚本步骤:
- 提供目录位置作为此步骤的输入
- 以文本形式读取文件
- 将文本设置为 soap 请求步骤的请求
- 运行 soap 请求步骤
- 读取响应并保存结果
- 重复直到文件列表存在并存在(不允许再进行 soap 步骤)
SOAP 请求步骤
这最初会有一些请求,上面的 groovy 步骤每次读取文件时都会覆盖。
因此,您必须使用上述 sudo 步骤实施 groovy。
希望对您有所帮助。
更新 根据以下评论,添加 groovy 脚本。
/**
* Closure definition requires inputs
* stepIndex : index of the request step where new content to be set
* contentToSet : the new request read from file
**/
def setRequest = { stepIndex, contentToSet ->
def step = context.testCase.testStepList[stepIndex]
step.testRequest.requestContent = contentToSet
}
//You may read a directory get the list of files and loop thru below steps for each file
//Read the request from file
def content = new File('/file/absolute/path').text
//Call above closure
//Assuming that Test Request step the second step, index becomes 1
setRequest(1, content)
我在一个 folder.I 中有大约 100 个请求 运行 一个一个地处理所有请求,并且需要在 SOAP UI 中捕获所有请求的响应。
有人可以帮助我了解详情吗?
在这里,您可以通过两个步骤创建一个测试用例:
- Groovy 脚本步骤
- SOAP 请求步骤
Groovy 脚本步骤:
- 提供目录位置作为此步骤的输入
- 以文本形式读取文件
- 将文本设置为 soap 请求步骤的请求
- 运行 soap 请求步骤
- 读取响应并保存结果
- 重复直到文件列表存在并存在(不允许再进行 soap 步骤)
SOAP 请求步骤 这最初会有一些请求,上面的 groovy 步骤每次读取文件时都会覆盖。
因此,您必须使用上述 sudo 步骤实施 groovy。
希望对您有所帮助。
更新 根据以下评论,添加 groovy 脚本。
/**
* Closure definition requires inputs
* stepIndex : index of the request step where new content to be set
* contentToSet : the new request read from file
**/
def setRequest = { stepIndex, contentToSet ->
def step = context.testCase.testStepList[stepIndex]
step.testRequest.requestContent = contentToSet
}
//You may read a directory get the list of files and loop thru below steps for each file
//Read the request from file
def content = new File('/file/absolute/path').text
//Call above closure
//Assuming that Test Request step the second step, index becomes 1
setRequest(1, content)