Reviewing test code: what to look for and how to say it
By Denis Bojkovski, Test Automation Architect · Published November 25, 2026
Tests deserve review
A fault in production code may be caught by a test. A fault in a test is caught by nobody: it stays green. Code review was mentioned in 6 of the 86 full descriptions on QAAnywhere on 25 November 2026, usually for SDET work, where you will review developers' tests and they yours.
The first question
Can this test fail for the right reason? Ask the author to break the product and show the failure. A surprising number of tests cannot fail.
var result = await service.SearchAsync("mug");
Assert.That(result, Is.Not.Null);
This passes for an empty list, wrong products, or an error object. Better:
Assert.That(result.Select(p => p.Sku), Is.EquivalentTo(new[] { "MUG-1", "MUG-2" }));
Other tests that cannot fail: a missing await on an asynchronous assertion, an assertion inside a loop over an empty list, and a catch that swallows the exception.
The checklist
- Name states behaviour and condition.
- Assertion concerns the behaviour in the name.
- Independence: passes alone, in any order, in parallel.
- Data is created here or clearly fixed.
- No sleeps, no real clock, no unplanned randomness.
- Level: could a faster test prove it?
- Failure message would help somebody else.
- Clean-up happens when the test fails.
- Secrets and personal data absent.
Formatting belongs to a tool. Do not spend human attention on it.
Hidden dependencies to spot
- A record identifier such as
42in the test. - Today's date, or the machine's time zone.
- A public website as the target.
- The order of a result that the code does not guarantee.
- Static fields.
Duplication is sometimes right
In production code, repetition is usually a problem. In tests, some repetition keeps each one readable by itself. Extract how something is done, such as creating a customer. Keep what is being proved visible. If a reader must open three files to see the expected value, too much was extracted.
Conditions and loops
A test with an if may take a path that asserts nothing. Use two tests, or parameters. Calculating the expected value with the same formula as the product repeats its mistake: write the literal answer.
Comments that help at a distance
Tone disappears in writing. Compare "This is wrong" with:
If the search returns nothing, this still passes. Could we assert on the SKUs? Happy to pair if the data makes it awkward.
State the consequence, suggest something, and say whether it blocks:
- blocking: would let a defect through, or will be flaky.
- suggestion: take it or leave it.
- question: I do not understand yet.
Praise specific things too: "Nice: this covers the concurrent case." If a thread passes three exchanges, call, and record the conclusion in the review.
Reviewing outside your strength
You can review a developer's unit test without knowing the code well. Read the names as a list of rules. Which rule from the ticket is missing? What about empty, maximum, and no permission? These questions are precisely what a tester adds.
Reviewing generated tests
Code assistants produce plausible tests quickly, and often assert what the code does now, defects included. Check the expected values against the requirement, not against the implementation, and delete tests that merely repeat it. See AI tools in testing.