Test Case

A test case describes a single HTTP operation. Only name and endpoint are required. All other fields are optional and mirror the fetch Request and Response objects.

Properties

KeyDescriptionDefault
nameHuman readable test namerequired
operationIdUnique identifier for the operationname
dependsOnArray of operationId strings that must pass firstnone
endpointRequest path relative to the base URLrequired
request.methodHTTP methodGET
request.headersAdditional request headersnone
request.bodyRequest payloadnone
request.*Any other valid fetch Request optionnone
response.statusExpected HTTP status200
response.jsonExpected partial JSON bodynone
response.schemaZod or JSON schema to validate responsenone
response.headersExpected response headersnone
response.*Other fetch Response fieldsnone
beforeSend(req, state)Function to finalize the requestnone
postTest(res, state, ctx)Function called after the responsenone
tagsTags used with --tags filteringnone
skipSkip this testfalse
focusRun only focused tests when presentfalse
repeatExtra sequential runs of the test0
bombardAdditional simultaneous runs of the test0
delayMilliseconds to wait before runningnone
timeoutPer‑test timeout overrideruntime timeout

Example

{
  name: 'Create a post',
  endpoint: '/posts',
  request: {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: { title: 'foo', body: 'bar', userId: 1 }
  },
  response: {
    status: 201,
    json: { id: 101, title: 'foo', body: 'bar', userId: 1 }
  }
}

If the server returns 201 with a matching body the case passes. Any mismatched status or body value results in a failure.

See Helpers for utilities that modify multiple cases at once.