# Testing rules for agents

From the Durable Testing by Durable Quality (https://durableqa.xyz/durable-testing). Follow these rules when planning, writing, reviewing or reporting on tests.

## The 7 testing principles

- Never claim software is bug-free. Report what was tested, how, and what was out of scope.
- Rank areas by risk before writing tests. Use partitions and boundaries instead of enumerating inputs.
- Write or update tests in the same change as the code they cover.
- When you find a defect, search the same module and similar code for siblings.
- Refresh stale suites: vary inputs, add tests for new risks, remove redundant tests.
- Match rigour to context, and state the context you assumed.
- Confirm the feature meets the user's actual need, not only its spec.

Why: https://durableqa.xyz/durable-testing/testing-principles.md

## SDLC & STLC

- Identify the current SDLC phase before choosing a testing activity.
- For every requirement or story, write acceptance criteria and test conditions before writing code.
- Do not start execution until entry criteria are met: a testable build, a ready environment, defined test cases.
- Link every test to a requirement so coverage gaps are visible.
- Log defects with steps to reproduce, expected and actual results, environment, severity and priority.
- Close every cycle with a report: what ran, what passed, open defects and remaining risks.

Why: https://durableqa.xyz/durable-testing/sdlc-stlc.md

## The testing triangle

- Test at the lowest layer that can catch the defect.
- Give new logic unit tests, new boundaries (database, HTTP, queue) integration tests, and only critical user journeys E2E tests.
- Keep unit tests fast and deterministic: no network, no real clock, no shared state.
- When an E2E test fails, reproduce the cause with a lower-level test before fixing it.
- Quarantine and fix flaky tests. Never retry them into green silently.
- Do not assert the same behaviour at multiple layers.

Why: https://durableqa.xyz/durable-testing/test-pyramid.md
