artillery.io JSON 值捕获不工作
artillery.io JSON value capture not working
使用 Artillery.io 1.6.0-10,我将 api 称为 returns 为 JSON 并尝试捕获其中一个值以供以后在流,但是捕获似乎不起作用。这是简化的代码:
get_ddg.yml
config:
target: "https://api.duckduckgo.com"
phases:
- duration: 3
arrivalCount: 1
scenarios:
- name: "Get search"
flow:
- get:
url: "/?q=DuckDuckGo&format=json"
capture:
json: "$.Abstract"
as: "abstract"
- log: "Abstract: {{ $abstract }}"
当我运行大炮时值为空:
$ artillery run get_ddg.yml
Started phase 0, duration: 3s @ 10:28:34(+0200) 2017-10-25
⠋ Abstract: <----- EMPTY! NO VALUE FOR $abstract
Report @ 10:28:37(+0200) 2017-10-25
Scenarios launched: 1
Scenarios completed: 1
Requests completed: 1
Concurrent users: 1
RPS sent: 2.08
Request latency:
min: 311.9
max: 311.9
median: 311.9
p95: NaN
p99: NaN
Scenario duration:
min: 349.5
max: 349.5
median: 349.5
p95: NaN
p99: NaN
Codes:
200: 1
非常感谢任何帮助。
找到解决方案。问题是捕获后如何读取变量。调用变量的正确方法不是使用 '$':
- log: "Abstract: {{ abstract }}"
使用 Artillery.io 1.6.0-10,我将 api 称为 returns 为 JSON 并尝试捕获其中一个值以供以后在流,但是捕获似乎不起作用。这是简化的代码:
get_ddg.yml
config:
target: "https://api.duckduckgo.com"
phases:
- duration: 3
arrivalCount: 1
scenarios:
- name: "Get search"
flow:
- get:
url: "/?q=DuckDuckGo&format=json"
capture:
json: "$.Abstract"
as: "abstract"
- log: "Abstract: {{ $abstract }}"
当我运行大炮时值为空:
$ artillery run get_ddg.yml
Started phase 0, duration: 3s @ 10:28:34(+0200) 2017-10-25
⠋ Abstract: <----- EMPTY! NO VALUE FOR $abstract
Report @ 10:28:37(+0200) 2017-10-25
Scenarios launched: 1
Scenarios completed: 1
Requests completed: 1
Concurrent users: 1
RPS sent: 2.08
Request latency:
min: 311.9
max: 311.9
median: 311.9
p95: NaN
p99: NaN
Scenario duration:
min: 349.5
max: 349.5
median: 349.5
p95: NaN
p99: NaN
Codes:
200: 1
非常感谢任何帮助。
找到解决方案。问题是捕获后如何读取变量。调用变量的正确方法不是使用 '$':
- log: "Abstract: {{ abstract }}"