taurus中单个场景中的多个json主体文件



我有下面的taurus yaml场景,其中有40次迭代和40个json文件。我在body文件标记中传递这40个body json文件。但当我运行yaml时,我只能看到一个请求在运行,而不是全部40个。请在这方面提供帮助。

execution:
- concurrency: 1
iterations: 40
hold-for: 0s
ramp-up: 0s
scenario: queryData
delay: 0s
queryData:
#data-sources:
#- /bzt/bzt_artifacts/query.csv
#delimiter: ","
requests:
- include-scenario: authCToken
- label: queryData
method: POST
url: ${TARGET_URL}
headers:
X-TR-Correlation-Id: ""
Authorization: "${authc_token}"
Content-Type: application/json
Accept: application/json
#DNT: 1
body-file: /bzt/bzt_artifacts/test1.json, test2.json etc., test100.json

为数据源创建文件my-sources.csv

test1
test2
...
test100

创建配置my-plan.yml:

execution:
- concurrency: 1
iterations: 40
scenario: example1
# other-settings: blah blah blah
scenarios:
example1:
requests:
- url: http://your-domain:8080/api/id/${test_id}
method: POST
body-file: data/${test_id}.json
data-sources:
- path: my-sources.csv
delimiter: ","
quoted: false
encoding: "utf-8"
loop: true
variable-names: test_id
random-order: false

当前目录的结构如下:

.
├── my-sources.csv
├── my-plan.yml
└── data
   ├── test1.json
   ├── test2.json
   .
.
.
   └── test100.json

然后你可以通过Docker:运行这个配置

$ docker run -it --rm -v `pwd`:/bzt-configs blazemeter/taurus my-plan.yml

参考

  • https://gettaurus.org/docs/JMeter/#HTTP-请求
  • https://gettaurus.org/docs/DataSources/

相关内容

  • 没有找到相关文章

最新更新