【问题标题】:Artillery - script.scenarios.forEach is not a function炮兵 - script.scenarios.forEach 不是函数
【发布时间】:2020-12-16 08:42:32
【问题描述】:

我是炮兵新手,陷入基本流程,我遇到以下问题:-

artillery run test_load.yaml

/usr/local/lib/node_modules/artillery/lib/commands/run.js:315
  script.scenarios.forEach(function(scenario) {
                   ^

TypeError: script.scenarios.forEach is not a function
    at checkIfXPathIsUsed (/usr/local/lib/node_modules/artillery/lib/commands/run.js:315:20)
    at fn (/usr/local/lib/node_modules/artillery/node_modules/async/lib/async.js:746:34)
    at /usr/local/lib/node_modules/artillery/node_modules/async/lib/async.js:1213:16
    at /usr/local/lib/node_modules/artillery/node_modules/async/lib/async.js:166:37
    at /usr/local/lib/node_modules/artillery/node_modules/async/lib/async.js:706:43
    at /usr/local/lib/node_modules/artillery/node_modules/async/lib/async.js:167:37
    at Immediate._onImmediate (/usr/local/lib/node_modules/artillery/node_modules/async/lib/async.js:1206:34)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)

yml 文件:-

config:
  http:
  target: 'https://sit-api.XX.com'
  phases:
    duration: 60
    arrivalRate: 20
  defaults:
    headers:
      Authorization: "Basic XXXX=="
scenarios:
  flow:
    post:
      url: '/XX/v1/XX?apikey=XX'
      sslAuth: false
      json:
        siteId: '132'
        orderId: '2220000666'
        productId: '102793419'
        timestamp: '202021-11-26T10:20.36'
        pickTaskId: 'XXX-XX-XX-8e6f135-Yj9Rw1n35'
        pickLocationId: 'U-XX-3'
        quantityPicked: 21.1
        quantityOrdered: 20.491
    expect:
      statusCode: 202

我正在使用以下命令运行这个 throw 终端:- 火炮运行 test_load.yaml

【问题讨论】:

  • 很高兴知道建议的答案是否解决了它...

标签: python performance-testing artillery


【解决方案1】:

根据文档,您需要列出您的场景:

scenarios:
  - flow:

您在关键字“flow”之前缺少“-”

https://artillery.io/docs/guides/guides/test-script-reference.html#Overview

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2020-02-04
  • 1970-01-01
  • 2020-05-12
  • 1970-01-01
  • 2021-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多