Read-only review of an application's test code for the test smells catalogued in Gerard Meszaros's xUnit Test Patterns (Addison-Wesley, 2007) — code smells (Obscure Test, Conditional Test Logic, Hard-to-Test Code, Test Code Duplication, Test Logic in Production), behavior smells (Assertion Roulette, Erratic Test, Fragile Test, Frequent Debugging, Manual Intervention, Slow Tests) and project smells (Buggy Tests, Developers Not Writing Tests, High Test Maintenance Cost, Production Bugs). Report...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Test Smeller?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/faelwar-test-smeller)
---
name: test-smeller
description: Read-only review of an application's test code for the test smells catalogued in Gerard Meszaros's xUnit Test Patterns (Addison-Wesley, 2007) — code smells (Obscure Test, Conditional Test Logic, Hard-to-Test Code, Test Code Duplication, Test Logic in Production), behavior smells (Assertion Roulette, Erratic Test, Fragile Test, Frequent Debugging, Manual Intervention, Slow Tests) and project smells (Buggy Tests, Developers Not Writing Tests, High Test Maintenance Cost, Production Bugs). Reports findings ranked by severity, each naming the smell and its specific cause, the evidence at file:line, the consequence, and the xUnit pattern that removes it. Use whenever the user asks to find "test smells", review test quality or test code, asks whether tests are "fragile", "flaky", "obscure", "too slow", "hard to maintain", mentions Meszaros or xUnit Test Patterns, or wants a test suite, test file or test diff critiqued — in any language or test framework.
---
# Test Smeller
A reviewer who reads tests the way *xUnit Test Patterns* teaches: tests are code too, and a test suite only pays for itself if its tests are **easy to read, independent, repeatable, fast, and able to fail**. A smell is a symptom; the finding names the smell, the **cause** behind it (the book distinguishes several causes for most smells, and the fix depends on which one it is), and the pattern that removes it.
The review is **read-only**: never edit files. Output is a report.
## 1. Resolve the target
| User says | Target | How to get it |
|---|---|---|
| nothing specific / "my changes" | test files changed vs. base branch, plus the production files they exercise | `git diff $(git merge-base HEAD <main-or-master>)` plus `git status` for untracked files |
| a PR number or URL | that PR's tests | `gh pr diff <n>` and `gh pr view <n>` |
| a file, folder or module | those tests as they stand (audit mode) | read the files |
| "the test suite" / the whole project | all tests | inventory first (§2), then sample or split by module |
| pasted code | that snippet | review it as is |
If the target contains no test code, say so and ask what to review.
## 2. Build context before judging
1. **Inventory the suite**: test framework(s) and runner config, test file locations and naming pattern, shared fixtures and helpers (`conftest.py`, `setup` files, base test classes, factories/builders, `__mocks__`, test data directories), CI test command. For a whole-suite audit, count tests per layer (unit / integration / end-to-end) and note test doubles in use.
2. **Read the project's own rules**: `CLAUDE.md`, `CONTRIBUTING.md`, testing guidelines. If the project deliberately chose a style (e.g. snapshot tests, a shared database fixture), do not flag the choice itself; flag only where it causes a concrete cost.
3. **Read each test with its fixture**: a test's meaning includes its setup, inherited `setUp`/`beforeEach`, fixtures and helpers. Many smells (General Fixture, Mystery Guest, Interacting Tests) are invisible inside the test body alone.
4. **Read the system under test (SUT)** enough to judge what each test is verifying, and to spot Test Logic in Production and Hard-to-Test Code.
5. **Gather project-level evidence** when auditing a suite: skipped/disabled tests, commented-out tests, test files the runner's pattern will not pick up, tests excluded from CI, retry-on-failure settings, git history of frequently edited test files.
## 3. Detect
Read `references/smells.md` at the start of every review. It has every smell with its causes, the code-level signals that reveal it in common frameworks, and when **not** to flag it. Read `references/patterns.md` for the remedy patterns and test-automation principles; fixes in the report use those names.
Work through the three families:
1. **Code smells**: found by reading test code. Do the full pass on every test in scope.
2. **Behavior smells**: show up when tests run. Detect them statically from their causes (a `sleep`, shared mutable fixture state, real clock/network/filesystem, order-dependent setup). Running the suite gives stronger evidence: run it twice, in random order if the framework supports it (`pytest -p random_order`/`pytest-randomly`, `jest --randomize`, `rspec --order random`, JUnit 5 `MethodOrderer.Random`), and time it (`pytest --durations=20`, `jest --verbose`, Gradle/Maven reports). Do this only when it is cheap (under ~2 minutes) or the user agrees, and never with plugins or flags that require changing the project's manifests. Label each behavior finding **observed** (seen in a run) or **inferred** (from code).
3. **Project smells**: only report these with evidence from the inventory (§2.5). Do not speculate about the team.
### Judgment rules
- **Name the cause, not just the smell.** "Obscure Test" alone is not actionable; "Obscure Test — Mystery Guest: expected totals live in `fixtures/orders.json`, invisible from the test" is.
- **Group by root cause.** Twelve tests with Assertion Roulette because of one shared helper is one finding listing the twelve locations, fixed once.
- **Proportionality.** Two lines of repeated setup are not Test Code Duplication worth a helper. One literal in an obviously-scoped test is not Hard-Coded Test Data. A deliberate Shared Fixture of immutable reference data is fine.
- **Framework idioms are not smells.** Table-driven tests in Go, `pytest.mark.parametrize`, `it.each`, and JUnit `@ParameterizedTest` are Parameterized Tests, not Conditional Test Logic. Multiple assertions on one outcome (e.g. fields of one returned object) are not Assertion Roulette when a failure message would still be clear.
- **Be specific.** Every finding has a `file:line`, the exact symptom, and a fix the author can act on.
- **Confidence.** If a smell depends on something you could not verify (e.g. whether tests run in parallel in CI), prefix it with "Unverified:" and say what would confirm it.
## 4. Severity
| Level | Meaning | Typical examples |
|---|---|---|
| **Critical** | The suite gives false confidence or changes production behavior. | Neverfail Test (assertion swallowed, never reached, or in a callback never invoked); Lost Test hiding a real failure; Test Logic in Production that alters runtime behavior (Test Hook, For Tests Only) |
| **High** | Results are untrustworthy or the suite actively resists change. | Erratic Test (Interacting Tests, Nondeterministic Test, Resource Optimism, Test Run War); Conditional Test Logic that can skip verification; widespread Fragile Test from Overspecified Software or Sensitive Equality; Slow Tests that push people to stop running the suite |
| **Medium** | Contained cost to readers and maintainers. | Obscure Test (Eager Test, Mystery Guest, General Fixture, Irrelevant Information); Assertion Roulette; Test Code Duplication; Indirect Testing |
| **Low** | Polish. | Missing Assertion Message where the assertion is clear anyway; isolated Hard-Coded Test Data; naming that hides intent |
When unsure between two levels, pick the lower one and say why it might be higher.
## 5. Report format
```markdown
# Test Smeller Review — <target>
**Verdict:** <one line, e.g. "2 tests can never fail; fixture coupling makes the order suite erratic">
**Scope:** <N test files / M tests reviewed; framework(s)> · **Context read:** <fixtures, helpers, SUT files, CI config> · **Suite run:** <not run | run 2× in random order, 41s — what was observed>
| Severity | Count |
|---|---|
| Critical | n |
| High | n |
| Medium | n |
| Low | n |
## Findings
### 1. [CRITICAL] <short title>
- **Smell:** <Smell> — <cause> (<code | behavior (observed/inferred) | project> smell)
- **Where:** `tests/orders.test.ts:42` (list every location if grouped)
- **Evidence:** <what the code does, concretely; a 1–5 line excerpt when it helps>
- **Consequence:** <what goes wrong: a bug that ships, a test that breaks for unrelated changes, a reader who cannot tell what is verified>
- **Fix:** <pattern name(s) from patterns.md and the concrete change; short code sketch when it clarifies>
### 2. [HIGH] ...
(ordered Critical → Low; within a level, by how many tests are affected)
## Smell map
| Smell | Cause | Findings |
|---|---|---|
| Obscure Test | Mystery Guest | #4, #7 |
## Worth keeping
- <good practices worth preserving, e.g. a clean Test Data Builder or Custom Assertion; optional>
## Not reviewed / open questions
- <out of scope, unverifiable, or needing the author's intent>
```
Number all findings so the user can refer to them ("fix #3"). Omit empty sections. If the tests are genuinely clean, say so plainly and do not manufacture findings.