# Reproduce the business-rule examples

Owned educational fixture, verified locally on 15 October 2026. It contains a deliberately seeded delivery-boundary defect. The defect was deliberately seeded for teaching. No customer data is used, execution makes no AI calls, and these are not hosted Cue April results or an evaluation of a coding assistant.

Requirement: delivery costs 500p below 5000p (£50), and is free from 5000p. Inputs in these examples are non-negative integer pence; the property generator is bounded to 5000..10000 inclusive. Input validation and other invoice behaviour are outside this fixture.

## Run

Install Node 24. Extract the ZIP, open the `testing-business-rules` folder, and run:

```sh
npm ci --ignore-scripts
npm run verify
```

The package lockfile pins the dependency tree. Verified with Node 24.21.0, fast-check 4.10.2, Stryker 10.0.0 and Cucumber.js 13.3.0. Stryker uses a temporary local worker logging socket.

`verify` expects the deliberately buggy commands to fail. It succeeds only when the weak tests pass, the known property counterexample is found and replayed, the expected Cucumber outcomes occur, and the boundary mutant survives the weak suite but is killed by the added boundary assertion. It saves a fresh summary and native reports under `results/`.

## Run each method

```sh
npm run test:weak:bug          # 2 tests pass despite the seeded bug
npm run test:property:bug      # intentionally exits 1, counterexample [5000]
REPLAY_PATH=26 npm run test:property:bug  # same failure, seed 20261015
npm run test:property          # corrected function, 1000 generated cases pass
npm run test:gherkin:bug       # intentionally exits 1, 1 of 3 scenarios fails
npm run test:gherkin           # corrected function, 3 scenarios pass
npm run test:mutation:weak     # 4 killed, 1 surviving mutant in this fixture
npm run test:mutation:strong   # boundary assertion kills the former survivor
```

The replay environment-variable syntax shown above is for POSIX shells. On PowerShell set `$env:REPLAY_PATH='26'` before the command and remove it afterwards. `npm run verify` performs the replay portably through Node.

The corrected implementation is in `src/delivery.mjs`; the intentional defect is in `src/delivery-buggy.mjs`. The weak mutation suite checks 4999p and 5001p. The strong suite also checks exactly 5000p. Mutation testing targets only the corrected source file and injects controlled changes into an isolated copy.

## Recorded results and limits

- fast-check found the known boundary defect after 27 generated cases with seed 20261015, path 26 and counterexample [5000]. No shrinking was needed. The corrected property passed 1000 requested cases.
- Cucumber's buggy run: 2 scenarios passed and 1 failed. Corrected run: 3 scenarios passed.
- Native Stryker weak report: 5 mutants, 4 killed and 1 survived. The survivor changed >= to >. Strong report: all 5 killed.

These results describe only this deliberately small local fixture. They do not establish a model benchmark, complete input coverage, a production release decision or performance of hosted Cue April agents. The homepage's 10,001-input browser enumeration and the separate older sample report are different examples; do not add their counts to these results.

Published log copies normalise the local working-directory path to `<example-root>` and temporary sandbox suffixes are retained. The tested code, recorded outcomes and counts are unchanged. Original local logs remain in the implementation report directory. `SHA256SUMS` fingerprints this published package; reruns can change timings and temporary paths.

## Primary documentation

- https://fast-check.dev/docs/core-blocks/runners/
- https://fast-check.dev/docs/api/interfaces/Parameters/
- https://stryker-mutator.io/docs/stryker-js/configuration/
- https://cucumber.io/docs/gherkin/reference/
- https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/step_definitions.md
