Skip to content

HTTP order workflow scenario package

A k6 load-test scenario that drives an order API from generated data.

related volume small ScenariosWorkflowOrders
Languages
eng
Formats
k6

Recipe

recipe.gbddl
gbddl 1
language eng

table customers rows 4 (
  id   int64 autoincrement primarykey
  name text same(person) fullName()
)

table orders rows 6 per(customers, 1, 3) (
  id          int64 autoincrement primarykey
  customer_id int64 fk(customers.id)
  total       decimal(10, 2) decimal(min: 10, max: 1000)
)

output k6 (
  baseurl: "https://staging.example.com"
  users: 10
  duration: 300
  iterations: 100
  rate: 50
  root orders ( object customer_id as customer )
  request create POST "/customers/{{customer_id}}/orders" body expect(201)
    header("Authorization", "Bearer {{env.API_TOKEN}}")
  request fetch GET "/orders/{{id}}" expect(200)
)

This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.

About this recipe

HTTP order workflow

A multi-table recipe that generates an HTTP scenario package: a k6 load-test script that drives an order API from generated customers and orders.

What it demonstrates

  • Scenario package — output k6 (...) renders a k6 script instead of a data file.
  • Scenario options — baseurl, users, duration, iterations and rate configure the load test.
  • Requests — create and fetch request blocks define the calls, with {{customer_id}} and {{id}} placeholders filled from the generated data and an environment token via {{env.API_TOKEN}}.
  • Projection — the root inlines customer_id as a customer object.

The other scenario tools (artillery, jmeter, postman, hurl, http) share this requests model and are covered by the conformance suite's golden bytes; this recipe demonstrates the family with k6.

Run it

Submit the recipe body to POST /api/v1/jobs?input_format=gbddl, or paste it into Chef, to generate the data. The repository's local runner (run by task test) also generates it.

The recipe outputs a k6 script, orders.js, that exercises the order workflow.

Guarantees

The generated script references real customer and order values and the requests resolve their placeholders. Values are synthetic.

Tested features

Smart types, physical types, rules and formats this recipe exercises and verifies.

fullNamedecimalfkpersame:personautoincrementprimary-keyprojection:rootprojection:objectscenario:baseurlscenario:usersscenario:durationscenario:iterationsscenario:rate