首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有多个场景和多参数的测试

具有多个场景和多参数的测试
EN

Stack Overflow用户
提问于 2017-12-11 14:40:22
回答 1查看 1.9K关注 0票数 1

我正在尝试用.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。

当前代码示例:

代码语言:javascript
复制
---

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

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2018-03-01 07:03:56

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

代码语言:javascript
复制
included-configs:  
  - additional-local-file.yml
  - another-config.yml

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47755294

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档