我正在尝试在.yml中编写一个taurus测试,其中包括多个场景(如ping主机请求,在机器上更改主机名,安装java,..)。每个场景都有一个API调用请求,包含url,POST方法和正文。
每个场景都应该在一个单独的文件中开发,测试应该这样调用:“bzt scenario_1.yml scenario_2.yml,...”。
是否有类似包含场景,导入的解决方案?
例如在Ansible中有include_tasks,所以我可以调用其他.yml脚本,一切都很好。
如何为body创建某种循环,以便我的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