Expand description
Scenario document model, parsing, and validation (ADR-0069 sections 1-2).
A scenario document is a .test.yaml (or .test.yml) sidecar that
declares one integration-tier test: exactly one route source
(routeFiles, routeFilesFromRoot, or inline routes), an ordered
scenario: action list, an optional env: map with fixed fixture
values, an optional envPassthrough: allowlist, an optional
endpoint-keyed partners: scripting map, and an optional pinned
profile. Unknown fields are rejected.
The scenario vocabulary and the unit-tier vocabulary (inputs,
expects, intercepts) never mix in one document. A document with
scenario: that also declares a unit-tier section is rejected at
load time.
Durations (deadline, duration, elapsedAtLeast) are humantime
strings, for example "5s" or "250ms", parsed during validation
so errors can name the action index.
Structs§
- Endpoint
Ref - An endpoint reference: a bare endpoint string or a map with
endpoint,provisioning, andbindVarkeys. - Partner
Expectation - The partner expectation of a
validateaction with apartnertarget: a recorded-request count bound plus optionalmethod,path, andquerysubset filters. - Partner
Script - One partner script of a
partners:entry: the response a partner serves when the system under test reaches its endpoint, or the fault it applies instead. Exactly one ofresponse/faultmust be declared. Grammar only; the runner consumes the map. - Partner
Script Response - The response a partner script serves.
- Scenario
Document - A parsed scenario document. Route file paths stay as declared; resolving them against the document directory or the project root is the runner’s job, the same split the unit-tier parser keeps.
Enums§
- Count
Bound - The recorded-request count bound of a
PartnerExpectation: exactly one bound form per expectation. Poll semantics per bound (arrivals only add, so the filtered count is monotone non-decreasing): - DocError
- Parse and validation errors for scenario documents.
- Expectation
- A validation expectation. The grammar keys mirror the mock-testkit
matcher rules:
equals,regex,contains,startsWith,endsWith,exists,jsonSubset. - Partner
Fault - The fault a partner script applies instead of serving a response.
- Path
Filter - The path filter of a
PartnerExpectationover the recorded path-and-query; at most one filter per expectation. - Provisioning
- Partner provisioning source (ADR-0069 section 9). The axis is who
owns the lifecycle.
testcontaineranduser-providedare reserved grammar values; the parser rejects them. - Route
Source - The route source of a scenario document. Exactly one form is declared; the parser rejects zero or multiple declarations.
- Scenario
Action - One ordered scenario action (ADR-0069 section 11, adopted from
Citrus:
send,receivewith a mandatory deadline,sleep,validate). - Scenario
Target - What a
validateaction asserts against. - Validate
Expectation - The expectation of a
validateaction, keyed by its target: the message matcher grammar forlastReceivedandvariabletargets, the partner count grammar forpartnertargets.
Functions§
- parse_
scenario_ document - Parses and validates a scenario document. Validation order:
(a) the path carries a reserved test-document suffix; (b) the text
deserializes; (c) a non-empty
scenario:section exists; (d) no unit-tier section coexists with it; (e) exactly one route source is declared; (f) each action converts (single-key dispatch, deadlines, durations, endpoint provisioning, expectation grammar) with action-index errors; (g) eachpartnersentry converts (script grammar, response status range) with entry-key errors; (h) noenvkey collides with a declaredbindVar; (i) eachpartnervalidate target URI equals a harness endpoint reference declared by the scenario’s ownsend/receiveactions.