Quick revision
The short answer
I would stop treating coverage percentage as the goal and report outcome-oriented measures instead: defect escape rate per team and mutation score for critical modules. Then I would make good tests easy and visible: test review sessions built on real incidents, shared test utilities such as data builders, fakes and ready Testcontainers setups, test quality written into code review guidelines, and per-team dashboards for flakiness and test runtime. The aim is to change what teams see and what is easy, not to add another target.
What to remember
In this answer, we raised unit test quality across 25 teams without adding another target. We replaced coverage as a goal with defect escape rate and mutation score for critical modules, taught with incident-based test reviews, made good tests easy through shared builders, fakes and Testcontainers setups, wrote test quality into review guidelines, and made flakiness and runtime visible per team.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would stop treating coverage percentage as the goal and report outcome-oriented measures instead: defect escape rate per team and mutation score for critical modules. Then I would make good tests easy and visible: test review sessions built on real incidents, shared test utilities such as data builders, fakes and ready Testcontainers setups, test quality written into code review guidelines, and per-team dashboards for flakiness and test runtime. The aim is to change what teams see and what is easy, not to add another target.
Why this question is asked
When 25 teams all meet a coverage target and defects still escape, the organisation has learned that the target measured the wrong thing. The temptation is to replace it with a stricter target, which usually repeats the problem. Interviewers ask this to see whether a senior engineer can change practice across many teams through measurement, tools and habits rather than mandates. In this answer, we will look at why the current state happens, which measures to use instead, how to teach with real incidents, what shared tools to build, how to bring test quality into review, and how to make flakiness and runtime visible.
1Why Met Targets and Escaped Defects Go Together
Coverage counts which lines and branches tests executed. It does not count whether any assertion checked the result. When teams are measured on coverage, the cheapest way to reach the target is to execute code, through tests of getters, tests without meaningful assertions, and tests that mock every collaborator. All of these raise coverage; none of them catch much.
So the first thing I would do is look at evidence from our own organisation. Take the last 20 production incidents, find the code that caused each one, and check its coverage. In most organisations in this state, the majority of that code was covered. That one slide changes the conversation, because it shows that the problem is not missing tests but tests that do not check behaviour.
2Change What Is Measured
I would remove coverage percentage as a team goal and keep it as a diagnostic engineers can look at. At the organisation level, I would report the defect escape rate per team, meaning defects found in production per release or per month, as a trend. For critical modules, such as payments, pricing and authorisation, I would add a mutation score from PIT, run nightly. Mutation testing changes the code on purpose and checks whether a test fails, so it measures whether tests detect faults.
I would be careful not to turn the mutation score into the new coverage target. It is shown with context: the trend, the surviving mutants that matter, and the escape rate next to it. The point is information for teams, not a ranking of them.
| Signal | Who uses it | How it is used |
|---|---|---|
| Coverage percentage | Engineers | Diagnostic to find untested code; not a goal |
| Coverage on new code | Reviewers | Check that changes come with tests |
| Mutation score, critical modules | Teams and tech leads | Nightly; surviving mutants guide fixes |
| Defect escape rate | Teams and leadership | Monthly trend per team |
| Flaky test count | Teams | Weekly, with quarantine and fix deadline |
| Test suite runtime | Teams | Trend per build; budget per suite |
3Teach With Real Incidents
People learn testing best from failures they recognise. I would run monthly test review sessions, an hour each, where one team brings a real incident and the tests that should have caught it. Together we look at why the tests passed: an assertion that only checked for null, a mocked calculator whose answer was stubbed, an edge case at a boundary no test used. Then we write the test that would have caught it.
These sessions work because they are concrete and blameless. A guideline that says assert specific values is easy to ignore; watching a real refund bug pass a test that asserted refund is not null is hard to forget. Over a year, with 25 teams, that is twelve sessions and a library of real examples that new engineers can read.
4Make Good Tests the Easy Option
Engineers write weak tests partly because good tests are harder to set up. If creating a valid Order takes 40 lines, people mock it instead. If starting a database for a test takes a day to figure out, people mock the repository. So a central platform or enablement team, perhaps three engineers, builds shared test utilities that every team can use.
Data builders let a test set only the fields it cares about. Fakes, simple working implementations of boundaries like a payment gateway, let tests check outcomes without mocking every call. A shared Testcontainers setup makes a real database test a two-line decision. When the good test is less work than the bad one, behaviour changes without any rule.
5Put Test Quality Into Review and Make Costs Visible
Code review guidelines usually say a great deal about production code and almost nothing about tests. I would add a short section with examples from our own code: tests are named after behaviour, assertions check specific values, verify() is used only when the call is itself the behaviour, there are no fixed sleeps, and each test covers one rule. Reviewers are asked to comment on test quality as normally as on naming or error handling.
Finally, two costs of a poor suite are easy to measure and rarely shown: flakiness and runtime. I would build a per-team dashboard from CI data showing how many tests failed intermittently in the last 30 days and how long the suite takes. A flaky test is quarantined automatically and must be fixed or deleted within two weeks. A suite that grows from 6 to 20 minutes becomes visible before it becomes normal. Teams usually act on these numbers by themselves, because they feel the pain every day.
- Show the evidenceincidents in covered code
- Retire coverage as a goalreport escape rate and mutation score
- Monthly incident-based test reviews
- Ship shared builders, fakes, containers
- Add test quality to review guidelines
- Dashboards for flakiness and runtime
- Escape rate falling after two quarters?YesKeep going, extend to more modulesNoRevisit with the teams
7 steps in order. Play them, or step through them one at a time.
Measurement, teaching, tools and visibility, in that order.
6Follow-up questions
How do you handle teams that resist dropping the coverage target?
Usually they are worried that without it, testing will decline. I would keep coverage on new code visible as a hygiene check and show that the new signals are stricter, not looser: a mutation score and an escape rate are harder to satisfy with empty tests than coverage ever was.
Who owns the shared test utilities?
A small platform or enablement team owns the core library, with contributions from product teams. The library is versioned and released like any other internal dependency, so teams can upgrade at their own pace and the utilities stay maintained.
How long before you expect results?
Flakiness and runtime improve within weeks once they are visible. Escape rate is slower, because defects show up in production with a delay, so I would expect a clear trend after two to three quarters and would report it honestly either way.
7Conclusion
In this answer, we raised unit test quality across 25 teams without adding another target. We replaced coverage as a goal with defect escape rate and mutation score for critical modules, taught with incident-based test reviews, made good tests easy through shared builders, fakes and Testcontainers setups, wrote test quality into review guidelines, and made flakiness and runtime visible per team.
Open with
The fact that every team meets coverage targets and defects still escape tells me we have been measuring execution rather than checking. So the first step is evidence: I would take recent incidents and show that most of the failing code was covered.
Then, if they want more
Then I would stop treating coverage as a goal. It stays as a diagnostic and coverage on new code stays visible in review, but at the organisation level I would report defect escape rate per team as a trend, and for critical modules a nightly mutation score from PIT, which shows whether tests actually detect faults.
I would be careful not to turn that into a new target. Next, teaching: monthly sessions where a team brings a real incident and the tests that should have caught it, and we write the missing test together. Then make good tests easy, because weak tests are often the path of least effort.
A small enablement team builds shared data builders, fakes for common boundaries and a ready Testcontainers setup. I would add a test section to our review guidelines with our own examples: behaviour names, specific assertions, no sleeps, verify only when the call is the behaviour.
Finally, per-team dashboards for flaky tests and suite runtime, with automatic quarantine and a two-week fix deadline. Teams tend to fix what they can see.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- PostgreSQL 17, Spring Boot 3.1
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- JUnit user guide, Mockito documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "How would you raise unit test quality across 25 teams where coverage targets are met but...": https://scrivio-interview-library.netlify.app/java/test-strategy/31e7eef4bb/