Testing Guide
weavster test verifies a project's flows with fixtures: an input document, the
expected output, and a comparison between them. Each fixture's input is parsed, run through
its flow, and compared to the expected output.
Fixture layout
Fixtures are grouped by the flow that transforms them. A fixture folder under fixtures/
names a flow in flows/, and each case inside it has one input and one expected file:
my-integration/
flows/
order.yaml # the flow
fixtures/
order/ # cases for flows/order.yaml
new-order/
input.json # source document
expected.json # output the flow should produce
existing-order/
input.json
expected.json
fixtures/<flow>/maps toflows/<flow>.yaml.- Each
<case>/has exactly oneinput.jsonand oneexpected.json. - Both files are JSON. (XML and other format packs arrive in later milestones.)
Running
weavster test [path]
For each case the harness parses input.json, runs it through flows/<flow>.yaml, and
compares the result to expected.json with a deep equality check. It prints ✓/✗ per
case (labelled <flow>/<case>), a closing passed count, and exits 1 if any case fails.
A failing case shows a line-by-line diff of pretty-printed JSON — - is expected, + is
actual:
✗ order/new-order
{
"id": "A-1001",
- "priority": "normal"
+ "priority": "high"
}
A flow that fails to load (missing or schema-invalid) fails every case under it; a flow that throws while running fails that case with the transform error.
Adding a fixture
- Make sure the flow exists at
flows/<flow>.yaml. - Create
fixtures/<flow>/<case>/named for the case. - Add
input.jsonwith a representative source document. - Add
expected.jsonwith the output the flow should produce for that input. - Run
weavster testand confirm the case passes.