Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Should a company with 400 Java repositories mandate one test framework? Use TestNG and JUnit as the example and discuss what standards are worth enforcing.

A single framework does reduce tooling, training and shared-library cost, and it matters most for shared test utilities and CI reporting, so I would standardise JUnit Jupiter for new code and let old suites converge. Mandating rewrites of working TestNG suites usually has low value. Where possible we enforce outcomes rather than tools: reports in a standard format, speed, flakiness limits and coverage of critical paths. TestNG and JUnit show why, since the gap between them has shrunk over twenty years, and standards should be revisited as the ecosystem changes, with explicit, time-bound exceptions.

Why this question is asked

Every growing engineering organisation eventually asks whether it should standardise its tools. Test frameworks are a good example because the arguments on both sides are real: one framework is cheaper to support, but rewriting thousands of working tests to satisfy a rule produces no new protection at all. Interviewers ask this leadership question to see how we reason about standards in general, what is worth enforcing, what is not, and how a standard stays sensible over time. In this answer, we will look at the history that shaped the TestNG and JUnit choice, separate the costs a single framework actually saves, decide what to mandate for new and existing code, describe the outcome standards worth enforcing, and finish with how to keep the standard current.

1A Quick Recap of How the Choice Came About

TestNG was created in 2004 to fill gaps in JUnit 3: it brought annotations, groups, data-driven tests, dependencies and parallel execution when JUnit had none of them. Many large organisations adopted it for that reason. JUnit 4 then added annotations, and JUnit 5, released in 2017, added parameterized tests, tags, extensions and parallel execution; JUnit 6 continues that model. Each step took ideas that TestNG had proven, so the gap between the two shrank from large to small.

The lesson for standards is that a choice that was clearly right in 2010 can be merely acceptable in 2026. A company with 400 repositories probably has both frameworks for historical reasons, not because anyone made a bad decision.

2What a Single Framework Actually Saves

The savings are real but concentrated. Shared test utilities, such as a test-data library, a Testcontainers setup or a custom reporting listener, must be written and maintained once per framework; with one framework, the platform team builds each of them once. CI reporting and test-selection tooling are easier when every repository behaves the same. Training and onboarding are simpler, and engineers move between teams without relearning lifecycle rules such as TestNG's one instance per class versus Jupiter's one per method.

Other costs barely change. A repository that uses TestNG on its own, with standard reports and no shared utilities, costs the company very little extra. So the value of standardising is highest where code is shared and lowest inside a single, stable repository.

Where one framework pays off
AreaSaving from one frameworkWorth mandating?
Shared test libraries and extensionsHigh: built onceYes, for new code
CI reporting and selection toolingMedium: fewer casesOnly the report format
Onboarding and mobilityMediumAs a default, not a rule
A stable repository with working TestNG testsLowNo rewrite mandate

3New Code Versus Existing Suites

So the standard I would set has two halves. For new code and new repositories, JUnit Jupiter is the standard, because that is where the ecosystem is: Spring Boot's test starter, Testcontainers, Mockito and IDE defaults all centre on it, and the shared libraries will be built for it. A team that wants TestNG for a new project needs an explicit exception with a reason.

For existing suites, there is no rewrite mandate. A TestNG suite that runs, reports in the standard format and meets the outcome standards below can stay. Suites converge naturally: when a team touches a test class for other work, it can migrate it, and both frameworks can run together on the JUnit Platform through the TestNG engine, so mixing is cheap. If a repository's TestNG usage starts costing the shared platform real money, for example because it needs special support in new tooling, that becomes a specific, funded migration with a deadline, decided case by case.

Imagine the alternative: a mandate to rewrite 120 TestNG repositories within a year. At even 2 engineer-weeks per repository, that is 240 engineer-weeks, roughly five engineers for a year, spent producing tests that check exactly what the old tests checked, with some risk of losing coverage along the way. That money is almost always better spent on the outcomes themselves.

4Enforcing Outcomes Instead of Tools

Where we can, we standardise what we actually care about. Reports: every repository publishes test results in JUnit XML to the central store, which both frameworks produce. Speed: the merge-blocking test stage of every repository stays within a budget, for example 15 minutes at the 90th percentile. Flakiness: flaky tests are quarantined within a day and fixed or deleted within a set time, with a limit on how many a repository may have. Critical paths: the business-critical journeys each team owns have automated tests that run before release.

These standards are framework-neutral, measurable from the central results data, and directly connected to quality. They also make the framework question less heated, because a team on TestNG that meets every outcome is clearly not a problem, while a team on Jupiter that misses them clearly is.

Step throughA test standard in layers
  1. Outcomes (enforced everywhere)report format, speed budget, flakiness limits, critical paths
  2. Defaults (for new code)JUnit Jupiter, shared libraries, CI templates
  3. Exceptions (explicit, time-bound)owner, reason, review date
  4. Existing suitesconverge when touched, no rewrite mandate

4 layers, from the top down. Step through them one at a time.

5Keeping the Standard Current

A standard is a decision made with the information of its time, so it needs a review date. Once a year, the platform team and engineering leadership look at whether the ecosystem has changed, for example a new JUnit major version, a framework losing maintenance, or a new testing approach becoming common, and whether the outcome numbers show that the standard is working. Exceptions carry an owner, a reason and an expiry date, and they are reviewed at the same time.

Leading this well is mostly about explaining the reasoning. When teams understand that the company standardises where sharing makes it cheaper and measures outcomes everywhere else, they accept the default for new code and stop arguing about old code.

6Follow-up questions

What do you say to a team that insists TestNG is better for their end-to-end suite?

That they may be right for that suite, and that the outcome standards apply either way. If they need TestNG features such as dependencies or suite files for a new suite, they can request an exception with the reason, an owner and a review date. What I would not accept is TestNG-specific shared tooling that the platform has to maintain on their behalf without a plan.

Is it ever right to mandate a full migration?

Yes, when the old tool becomes a liability, for example if it stopped being maintained, has security issues in its dependencies, or blocks a platform change such as a new Java version. Then it is a funded programme with a clear deadline, and the cost is weighed against that specific risk rather than against a wish for uniformity.

How do you measure whether the standard is working?

From the central test-results data: the share of repositories meeting the speed budget and flakiness limits, the trend of flaky tests and skips, how many repositories publish reports, and how long shared tooling takes to roll out. If outcomes improve and new repositories follow the default, the standard is doing its job.

7Conclusion

In this answer, we saw that TestNG filled real gaps in JUnit 3 and that JUnit adopted many of its ideas, so the gap has shrunk. A single framework saves money mainly in shared utilities and CI reporting, so we standardised JUnit Jupiter for new code, refused to mandate rewrites of working suites, enforced framework-neutral outcomes such as standard reports, speed budgets, flakiness limits and critical-path coverage, and kept the standard current with yearly reviews and explicit, time-bound exceptions.

What to say in the interviewAbout 90 seconds aloud

Open with

I would standardise, but carefully, on what actually saves money. A single framework pays off mostly where things are shared: test-data libraries, container setups, reporting listeners and CI tooling only need to be built once.

Then, if they want more

It also helps onboarding. Inside a single stable repository, though, a working TestNG suite costs the company very little. So I would make JUnit Jupiter the default for all new code, because that is where the ecosystem is, Spring Boot's test starter, Testcontainers, Mockito and the IDEs, and any new TestNG use needs an explicit exception.

I would not mandate rewrites of working suites: at a couple of engineer-weeks per repository across a hundred-plus repositories, that is a year of several people's time to reproduce tests we already have. Old suites converge as they are touched, and both frameworks can run together on the JUnit Platform with the TestNG engine.

What I would enforce everywhere are outcomes: results in JUnit XML to the central store, a time budget for merge-blocking tests, flaky-test limits with quarantine deadlines, and tested critical journeys. Those are framework-neutral and measurable. The TestNG and JUnit history is a good reminder why: TestNG filled real gaps in JUnit 3, JUnit adopted those ideas, and the gap shrank.

So standards need a yearly review, and every exception gets an owner and an expiry date.

About this answer

Last updated
12 November 2026
Versions it names
JUnit 3, JUnit 4, JUnit 5, JUnit 6
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.
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 "Should a company with 400 Java repositories mandate one test framework? Use TestNG and...": https://scrivio-interview-library.netlify.app/java/testng/5e0cfeece0/