linux - 多场景多参数测试

标签 linux api yaml continuous-testing taurus

我正在尝试在 .yml 中编写一个包含多个场景的 taurus 测试(例如 ping 主机请求、更改机器上的主机名、安装 java 等)。 每个场景都有一个 API 调用请求,带有 url、POST 方法和正文。

问题一:

每个场景都应该在单独的文件中开发,测试应该这样调用:“bzt scenario_1.yml scenario_2.yml,...”。

有没有include_scenario,import之类的解决方案?

例如,在 Ansible 中有 include_tasks,所以我可以调用其他 .yml 脚本,一切都很好。

问题2:

我如何为主体创建某种循环,以便我的 API 请求将为每个分布使用不同的参数。因为我正在尝试编写一个具有高并发性的测试,例如 ping、更改主机名并为 Ubuntu、Debian、Centos 等安装 Java。

当前代码示例:

---

execution:
- iterations: 2
  concurrency: 1000
  ramp-up: 20m

  scenarios:

   ping:
    requests:
    - url: http://127.0.0.1:12121/ping/
      method: POST
      label: ping
      body-file: ./vars/"{{ping}}"
      headers:
        Content-Type: application/json
      parameters:
        - /debian/ping.json
        - /ubuntu/ping.json
        - /centos7/ping.json

   changeHostname:
    requests:
    - url: http://127.0.0.1:12121/changeHostname/
      method: POST
      label: ping
      body-file: ./vars/"{{change_hostname}}"
      headers:
        Content-Type: application/json
      parameters:
        - /debian/hostnameDto.json
        - /ubuntu/hostnameDto.json
        - /centos7/hostnameDto.json

   changeRootPassword:
    requests:
    - url: http://127.0.0.1:12121/changeRootPassword/
      method: POST
      label: ping
      body-file: ./varss/"{{change_root_password}}"
      headers:
        Content-Type: application/json
      parameters:
        - /debian/changeRootPasswordDto.json
        - /ubuntu/changeRootPasswordDto.json
        - /centos7/changeRootPasswordDto.json

reporting:
  - module: console
  - module: final-stats

settings:
  check-interval: 5s
  default-executor: jmeter

provisioning: local

谢谢。

最佳答案

YAML 中有一个设置可以包含其他配置文件:

included-configs:  
  - additional-local-file.yml
  - another-config.yml

http://gettaurus.org/docs/ConfigSyntax/#Included-Configs

关于linux - 多场景多参数测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47755294/

相关文章:

php - Zimbra SOAP 创建帐户

css - Jekyll 包括查找错误的目录永久链接

r - 在 Quarto 书籍模板中将数据从一个 qmd 文件传递​​到另一个文件?

c - 如何获取我存储在子进程变量中的子进程外部变量的值?

python - linux环境下python修改excel文件

java - 如何从url中过滤txt

c# - 如何从 ASP.NET Core 页面调用我的 API Controller 对象?

python - 在 app.yaml 中定义路由与在 AppEngine 中的 WSGIApplication 中定义一个大型映射相比,是否有性能提升?

linux - 如何检查我不知道名称的服务是否在 Ubuntu 上运行

android - sed 匹配/复制然后放入 posix shell