Instruction file imported from ImDjinn/Copilot-Optim (
.github/instructions/testing.instructions.md). Copyright stays with the author.
Testing Guidelines
Tests are deterministic controls — they either pass or fail, with no ambiguity. This is their primary value in an agentic workflow: a failing test resets agent accuracy to near 100% at each step.
Rules
- Every new behavior must have a test before the implementation is considered done.
- Tests must be isolated: no shared mutable state between test cases.
- Test the behavior, not the implementation. Avoid testing private internals.
- A test that never fails is not a test — verify it fails before the fix is in place.
Structure
- Unit tests: one assertion per test case where possible.
- Integration tests: cover the contract between components, not internal details.
- Name tests descriptively:
should <behavior> when <condition>.
Agent Guard Rails
- After each implementation step, run the full test suite.
- If any previously passing test breaks, stop and fix it before continuing.
- Do not suppress, skip, or comment out failing tests to make the suite pass.
- Security scanners and linters are also deterministic controls — run them as part of the same guard rail loop.