我正在尝试用.yml编写一个金牛座测试,它将包含多个场景(比如ping主机请求、在机器上更改主机名、安装java、.)。每个场景都有一个API调用的请求,其中包含url、POST方法和body。
问题1:
每个场景都应该在一个单独的文件中开发,并且测试应该这样命名:"bzt scenario_1.yml scenario_2.yml,.“。
有像include_scenario这样的解决方案,导入吗?
例如,在Ansible中有include_tasks,所以我可以调用其他.yml脚本,一切都很好。
问题2:
如何为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谢谢。
发布于 2018-03-01 07:03:56
YAML中有一个包含其他配置文件的设置:
included-configs:
- additional-local-file.yml
- another-config.ymlhttp://gettaurus.org/docs/ConfigSyntax/#Included-Configs
https://stackoverflow.com/questions/47755294
复制相似问题