The testing strategies RegelRecht uses, led by Gherkin BDD scenarios run with cucumber-rs.
RegelRecht uses several testing strategies.
The primary testing approach uses Gherkin feature files executed by cucumber-rs.
Feature files live in two places, and the difference decides who fixes a failure:
corpus/regulation/**/scenarios/*.feature, run against the real corpus. A failure means a law changed or the scenario went stale, and a human decides which. Scenarios tagged @wip are skipped.bdd/conformance/*.feature, tagged by tier, proving an engine speaks the whole language against synthetic test_* laws. CI blocks on this bucket.bdd/grammar.yaml is the single source of truth for the step phrasings. The bindings for every engine are generated from it: Rust through packages/engine/build.rs, the editor and demo JavaScript through bdd/codegen/gen-js.mjs, which writes packages/frontend-shared/src/gherkin/grammar.generated.js (re-exported for the editor by frontend/src/gherkin/). Never hand-edit a generated file. Change grammar.yaml and run just bdd-codegen.
A step that is not in grammar.yaml does not exist. A minimal scenario:
Laws that need source data (BRP, Belastingdienst, and the like) provide it with a data-table step keyed on the identifier the law looks up:
See corpus/regulation/nl/wet/wet_op_de_zorgtoeslag/scenarios/eligibility.feature for a complete, data-driven example.
Test scenarios are derived from the Memorie van Toelichting (MvT), the explanatory memorandum that accompanies Dutch legislation. The MvT contains examples and reasoning from the legislature that serve as ground truth for expected behavior.
just check runs what CI runs: formatting, lints, a build check, schema and annotation validation, the script test suites, and the full Rust test suite. Run it before pushing.
The first three also run on their own, and the pre-commit hooks call them the same way:
The Rust unit and integration tests, across every crate in the workspace:
Checks that the Rust law-model accepts exactly what the JSON schema accepts. What it covers, and what conformance does not cover yet, is on Conformance; adding a fixture is described in packages/engine/tests/conformance/README.md.
cargo-mutants checks whether the tests actually pin behavior or merely execute it. CI runs the diff variant as a gate on changed code.
just test-e2e builds the engine to WASM and drives the editor with Playwright.
Every rulework is validated against the JSON schema:
just demo-check checks the demo end to end: the laws, their scenarios, the frontend tests, and the WASM build. Run it before pushing anything demo-related.
Performance benchmarks using Criterion:
An exploration into transparent, executable legislation, and one of the three projects in the starting selection of the Nederlandse Digitale Dienst.
GitHub repository
How it works
Stay informed
Roadmap (Dutch)
Documentation
Research
Nederlandse Digitale Dienst
Ministry of Economic Affairs and Climate Policy