Agent Wranglers

TST-34Recommended

Review tests like code

Review test code with the same care as production code. It must be clear, small and free of copy and paste.

How to do it

Check that each test name states a behaviour and that the setup is short. Share setup through factories and helpers, not copied blocks. Reject tests that only check that a mock was called with the code's own arguments. With agent-written tests, also look for weakened checks and skipped work.

How to check

The linter and type checker run on test files with the same settings as production code. A copy-and-paste detector, such as jscpd or PMD CPD, fails the check on duplicated blocks in tests. The code review questions cover the test files in every pull request.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/testing/test-quality/review-tests">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.