简体   繁体   English

使用多个场景和多个参数进行测试

[英]Tests with multiple scenarios and multiple parameters

I'm trying to write a taurus test in .yml that will include multiple scenarios (like ping host request, change hostname on machine, install java,..). 我正在尝试在.yml中编写一个金牛座测试,其中将包括多种情况(例如ping主机请求,更改计算机上的主机名,安装Java等)。 Every scenario has a request that is an API call, with url, POST method and body. 每个方案都有一个使用URL,POST方法和正文的API调用请求。

Problem 1: 问题一:

Every scenario should be developed in a separate files, and tests should be called this way: "bzt scenario_1.yml scenario_2.yml,...". 每个方案都应在单独的文件中开发,并应以这种方式调用测试:“ bztcensage_1.ymlcensage_2.yml,...”。

Is there a solution like include_scenario, import? 是否有诸如include_scenario,import这样的解决方案?

For example in Ansible there is include_tasks, so I can just call other .yml scripts and everything works great. 例如在Ansible中有include_tasks,因此我可以调用其他.yml脚本,并且一切正常。

Problem 2: 问题2:

How can I create some kind of loop for body, so that my API request will use different parameters for each distribution. 我如何为主体创建某种循环,以便我的API请求将为每个分发使用不同的参数。 Cause I'm trying to write a test with high concurrency that will for example ping, change hostname and install Java for Ubuntu, Debian, Centos,.. 原因我正在尝试编写具有高并发性的测试,例如ping,更改主机名并为Ubuntu,Debian,Centos等安装Java。

Current code sample: 当前代码示例:

---

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

Thank you. 谢谢。

There is a setting in YAML to include other config files: YAML中有一个设置可以包括其他配置文件:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM