grimoire-test
Use the test boundary and structure that best expose the relevant failure, not a mandatory unit-test or AAA template.
Under orchestration, the caller's execution contract takes precedence over this skill's standalone defaults.
Standalone, design, write, and run relevant tests unless the request narrows that scope.
Test selection
Identify observable behavior, stable invariants, material boundaries, failures, and state transitions. Reuse adequate existing coverage; do not add a test solely to produce an artifact.
Hard setup is a testability signal, not an automatic stop. Use useful characterization/integration tests where unit isolation would require scope-expanding production changes. Recommend refactoring rather than making unauthorized changes.
Use real collaborators when fast and deterministic. Use stubs for controlled values, mocks for contractual interactions, and fakes for reusable behavior. Isolate external resources in unit tests without doubling every in-process collaborator. Prefer the real system under test; document partial-mock compromises.
Prefer public outcomes, but allow focused internal assertions for characterization, complex invariants, or precise regressions when the coupling is worthwhile. Choose scenario, table-driven, property, state-machine, snapshot, concurrency, or framework-native structure as appropriate. Several assertions may describe one coherent scenario. Keep tests independently runnable and avoid accidental shared mutable state.
For dependency or structure choices needing examples, read patterns.md and examples.md.