炮兵不发射场景

问题描述

我在 http://localhost:5000 上运行我的节点服务器,并想使用 artillery 进行性能测试。

这是我的 yaml 文件

config:
  target: http://localhost:5000
phases:
- duration: 20
  arrivalRate: 3
  name: Warm up
scenarios:
- name: Test1
  flow:
  - post:
      url: /give
      json:
        item:
          'name': 'book'
          'price': '4.99'
        total:
          'cost': '7.56'

但我得到了这个结果(似乎测试根本没有运行)

Elapsed time: 0 seconds
  Scenarios launched:  0
  Scenarios completed: 0
  Requests completed:  0
  Mean response/sec: NaN
  Response time (msec):
    min: NaN
    max: NaN
    median: NaN
    p95: NaN
    p99: NaN

All virtual users finished
Summary report @ 15:48:49(+0530) 2021-07-07
  Scenarios launched:  0
  Scenarios completed: 0
  Requests completed:  0
  Mean response/sec: NaN
  Response time (msec):
    min: NaN
    max: NaN
    median: NaN
    p95: NaN
    p99: NaN
  Scenario counts:

知道我做错了什么吗?

解决方法

我在编写 yaml 文件时出错,phases 应该在 config

config:
  target: http://localhost:5000
  phases:
  - duration: 20
    arrivalRate: 3
    name: Warm up
scenarios:
- name: Test1
  flow:
  - post:
      url: /give
      json:
        item:
          'name': 'book'
          'price': '4.99'
        total:
          'cost': '7.56'