Test Suite Audit
Audit tests for correctness, quality, and adherence to best practices.
Step 1: Clarify Scope
Always ask the user before proceeding:
Would you like me to audit:
- A specific file — Provide the path to the test file
- Only changed files — I'll audit tests in the diff against
main(new or modified tests)- The entire project — I'll scan for all test files in the codebase
Which would you prefer?
Wait for the user's response before continuing.
Step 2: Gather Context
Identify:
- Language and framework — Jest, pytest, RSpec, JUnit, PHPUnit, etc.
- Test type — unit, integration, or feature/E2E
- Code under test — locate and review if available
- Project conventions — infer from existing tests, config, or docs
Use the project's conventions and tooling to locate test files:
| Framework | Test Location | Config | Naming Pattern |
|---|---|---|---|
| Jest | __tests__/, *.test.js | jest.config.js | *.test.js, *.spec.js |
| Vitest | __tests__/, *.test.ts | vitest.config.ts | *.test.ts, *.spec.ts |
| Mocha | test/ | .mocharc.js, mocha.opts | *.test.js, *.spec.js |
| Go | Same as source | go.mod | *_test.go |
| Rust | src/, tests/ | Cargo.toml | mod tests, tests/*.rs |
| JUnit/Java | src/test/java/ | pom.xml, build.gradle | *Test.java, *Tests.java |
| C# (xUnit/NUnit) | *.Tests/ project | *.csproj | *Tests.cs, *Test.cs |
| PHP (PHPUnit) | tests/ | phpunit.xml | *Test.php |
| Laravel | tests/Unit/, tests/Feature/ | phpunit.xml | *Test.php |
| Symfony | tests/ | phpunit.xml.dist | *Test.php |
| Ruby (RSpec) | spec/ | .rspec, spec_helper.rb | *_spec.rb |
| Rails | spec/ or test/ | .rspec, rails_helper.rb | *_spec.rb, *_test.rb |
| Django | tests/, */tests.py | pytest.ini, setup.cfg | test_*.py, *_test.py |
Also check for:
- Package manager scripts (
composer test,bundle exec rspec,python manage.py test) - CI configuration files for test commands
Step 3: Apply Audit Criteria
See references/audit-criteria.md for the complete checklist covering:
- Test validity
- Assertion quality
- Test isolation
- Naming and structure (including AAA enforcement)
- Coverage quality
- Maintainability
- Framework conventions
Step 4: Report Findings
For each issue:
### [HIGH | MEDIUM | LOW] Issue Title
**File**: `path/to/test_file.ext`
**Test**: `test name`
**Lines**: X–Y
**Problem**: What's wrong
**Current**:
[code snippet]
**Fix**:
[corrected code]
**Why**: One-sentence rationale
Step 5: Summarize
Conclude with:
- Critical issues — false positives, tests that verify nothing
- Quality issues — weak assertions, missing edge cases
- Style issues — naming, organization, minor fixes
- Overall health — one paragraph assessment
- Top 3–5 priorities — highest-impact improvements