artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
7.95k stars 507 forks source link

Multiple Configs and Processors #1467

Closed ramgiteng closed 2 years ago

ramgiteng commented 2 years ago

Hello,

I am trying to create a complex config.yml file, which consists of a combination of configurations. I would like to create multiple configs - each of which has its own set of processors, load phases, and scenarios.

Use Case:

To Combine multiple configs and/or processors in the same YAML file

YAML File 1:

config:
  target: "http://www.lambdatest.com"
  processor: "../Script1.js"
  phases:
    - duration: 15
      arrivalCount: 3
scenarios:
  - flow:
    - function: "function1"
config:
  target: "http://www.lambdatest.com"
  processor: "../Script2.js"
  phases:
    - duration: 15
      arrivalCount: 3
scenarios:
  - flow:
    - function: "function2"

YAML File 2:

config:
  target: "http://www.lambdatest.com"
  processor: "../Script1.js"
  phases:
    - duration: 15
       arrivalCount: 3
  processor: "../Script2.js"
  phases:
    - duration: 15
       arrivalCount: 3  
scenarios:
  - flow:
    - function: "function1"
  - flow:
    - function: "function2"

Expected Outcome:

Using either one of the above configurations, ../Script1.js to execute first with its specified load phases and corresponding scenario (function 1) before executing ../Script2.js with its corresponding load phases and scenario (function 2).

Actual Outcomes:

Questions:

  1. How can we model a workload scenario using Artillery to use multiple configs (each config has its own set of configurations like load phases, processor, scenarios) such that each config is executed sequentially?
  2. How can we run multiple config.yml files sequentially using artillery run config1.yml config2.yml? (This seems to run both config.yml files simultaneously)
hassy commented 2 years ago

hi @ramgiteng

The config.environments feature may be what you're looking for. You can use it to create several different environments (or profiles), each with its own load phases, plugins etc.

Multiple config or scenarios sections in one YAML file are not supported (as YAML would treat them as duplicate keys in an object)

A common pattern for having multiple scenarios is to store each scenario in its own file.