gpt4 book ai didi

soapui - 如何在 SOAP UI 中运行多个请求并存储所有响应?

转载 作者:行者123 更新时间:2023-12-02 08:49:46 24 4
gpt4 key购买 nike

我在一个文件夹中有大约 100 个请求。我希望一一运行所有请求,并且需要在 SOAP UI 中捕获所有请求的响应。

有人可以帮我提供详细信息吗?

最佳答案

在这里您可以通过两个步骤创建一个测试用例:

  • Groovy 脚本步骤
  • SOAP 请求步骤

Groovy 脚本步骤:

  1. 提供目录位置作为此步骤的输入
  2. 将文件作为文本读取
  3. 将文本设置为肥皂请求步骤的请求
  4. 运行肥皂请求步骤
  5. 读取响应并保存结果
  6. 重复直到文件列表持续并存在(不允许再次执行肥皂步骤)

SOAP 请求步骤这最初会有一些请求,上面的常规步骤会在每次读取文件时覆盖。

因此,您必须使用上述 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)

关于soapui - 如何在 SOAP UI 中运行多个请求并存储所有响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32358860/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com