HTTP test bundles

A test bundle packages generated records together with HTTP requests your testing tool can run. Add output.package and a tool-independent scenario to a recipe; Ghost Bakery translates the scenario for the tool you picked.

api-load-test.yaml
version: "1"
output:
  language: eng
  format: json
  package: k6
  quantity: 100
scenario:
  baseURL: "${BASE_URL}"
  load:
    virtualUsers: 10
    durationSeconds: 30
  requests:
    - name: create-user
      method: POST
      path: /users
      headers: { Content-Type: application/json }
      body: { name: "{{name}}", email: "{{email}}" }
      expect: { status: [201] }
fields:
  - { name: name, type: text, category: fullName }
  - { name: email, type: email }

The bundle is a ZIP with the generated dataset, the translated scenario and a README.md with the command to run it. For the example above: test.js, data.json and README.md.

Packages

package Tool Requires Scenario file Data file Status assertions
k6 JavaScript load-test script for Grafana k6. format: json test.js data.json yes
artillery YAML load-test script with a CSV payload. format: csv test.yaml data.csv
jmeter JMX test plan with a CSV data set. format: csv test-plan.jmx data.csv
postman Postman Collection for the collection runner. format: json collection.json data.json yes
hurl Hurl file for CI and end-to-end checks. format: json requests.hurl data.json yes
http .http request file for IDE HTTP clients. format: json requests.http data.json

Status assertions come from expect.status. Tools without them still get the requests and the data. Bundles are always a single file, so output.files must stay 1.

The scenario section

Key Required Meaning
baseURL yes Target service. A literal URL, or an environment placeholder such as ${BASE_URL} that you set when running the test.
load Execution profile; see below.
requests yes One or more requests, run in order.

load

Key Meaning
virtualUsers Concurrent virtual users.
durationSeconds Test duration. Required when arrivalRate is set.
iterations Total iterations.
arrivalRate New virtual users per second.

All values must be zero or positive. Each tool uses the settings it supports and ignores the rest.

requests

Key Required Meaning
name yes Label shown by the tool.
method yes GET, HEAD, POST, PUT, PATCH, DELETE or OPTIONS.
path yes Path starting with /, appended to baseURL.
headers Map of header names to values.
body JSON body, written as YAML.
expect.status Accepted status codes, from 100 to 599.

Placeholders

{{field}} in a path, header value or body inserts the value of that field from the generated record. Depending on the tool, the bundle binds the data file (one record per iteration) or inlines a generated record.

placeholders.yaml
path: /users/{{id}}/orders
headers: { X-Request-Id: "{{request_id}}" }
body: { sku: "{{sku}}", quantity: 1 }