我通过金牛座运行加特林查询一些REST端点使用以下YAML配置
execution:
- executor: gatling
concurrency: 1
hold-for: 30s
ramp-up: 3s
scenario: Thread Group
scenarios:
Thread Group:
requests:
- label: demo
method: GET
url: https://Cname/health
assert:
- contains:
- “healthy”
subject: body
regexp: true
not: true
和它返回200的所有测试 - 耶!然而,当我将“健康”与“SomeText”则会它仍然返回200 :(。我怀疑这是不是执行断言条件,仅仅是验证有一个终点。任何有识之士将不胜感激?
正确的答案写涉及包含一个场景一个单独的脚本。这可以如下面注入到代码查询的响应。
val scn = scenario("check return details")
.exec(http("check the actual return ")
.get("urlLocation")
.check(jsonPath("$.friendlyName").is("testName")))