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.89k stars 502 forks source link

Using $ref in YAML files to avoid duplication #3298

Open RikdeVos opened 1 month ago

RikdeVos commented 1 month ago

We'd like to propose a feature to use get rid of some YAML duplication by using $ref. This syntax is also available in openapi-spec definitions, and seems to be getting more traction lately by other tooling using YAML.

Examples:

# test.artillery.yml
scenarios:
  - flow:
    - $ref: "auth.yml/#/steps/login"
    - get: 
        name: Get secure resource
        url: "/foo"
        headers:
          $ref: "auth.yml/#/headers"

# auth.yml
steps:
  login:
    - post:
        url: "/login"
        capture:
            - json: "$.accessToken"
              as: "accessToken"
headers:
  Content-Type: application/json
  Authorization: "Bearer {{ accessToken }}"
hassy commented 1 month ago

This is a great suggestion @RikdeVos, thank you! There's a few things we'd like to improve in Artillery's support for reusability of test definitions, this could be one of them.