Your organisation runs a large TestNG Selenium suite beside backend services tested with JUnit Jupiter. Would you standardise on one runner, and how would you decide?
answer
- standardise conventions before runners
- inventory what the suite really uses
- migration cost against uniformity
- one launch for two engines
- a rule for new code
basics
~20 sNot by default. Inventory which TestNG-only features the Selenium suite relies on, price the redesign, and usually standardise on JUnit Jupiter for new code while keeping the working TestNG suite until a real trigger justifies migrating it.
solid answer
~50 sI would standardise the things that hurt when they differ, such as results format, assertion style, naming and CI conventions, before forcing one runner. Then I would inventory the TestNG suite: mechanical features like groups, data providers and timeouts port cheaply, while `dependsOnMethods` chains, suite-file `@Parameters`, factories and the parallel setup need redesign. If the inventory shows heavy use of those, rewriting a working Selenium pack for uniformity rarely pays. A common outcome is JUnit Jupiter as the default for new code, the TestNG suite kept and maintained, and a written trigger for migrating it, such as a major rewrite. If one launch matters, the JUnit team's TestNG engine can run TestNG classes on the JUnit Platform beside Jupiter. TestNG 7.10's removal of JUnit support shows why hosting one framework inside the other is not a strategy.
go deeper
Know that both runners can coexist in one organisation and that switching a large suite is costly work, not a rename.
Explain which TestNG features translate mechanically to JUnit Jupiter and which need redesign, since that drives any migration estimate.
Show how a migration can silently lose coverage and what verification a move between runners needs before you trust it.
Own the call: weigh coordination cost against migration risk, set the rule for new code, record a migration trigger, and say when you would choose one launch with two engines.
## The shape of the decision The scenario is common: a QA automation team owns a large **TestNG** suite driving Selenium, while service teams write **JUnit Jupiter** (JUnit 5 and 6) tests. Someone asks whether the organisation should standardise. There is no single right answer; a lead is expected to separate what genuinely costs money when two runners coexist from what is merely untidy. ## What two runners actually cost - **Skills and onboarding.** Engineers moving between teams learn two annotation sets, two hook models and two default instance lifecycles, and carry the wrong assumption across. - **Shared libraries.** Test utilities, extensions and listeners are written twice, once as JUnit extensions and once as TestNG listeners. - **Reporting and CI.** If each runner's results land differently, dashboards and failure triage split. Both can produce the JUnit-style XML result files CI servers read, which removes much of this cost. - **Build and dependency upkeep.** Two frameworks to upgrade, two sets of release notes. TestNG 7.10 removed TestNG's ability to run JUnit 3/4 tests after deprecating it in 7.7.0, and teams that missed the note lost tests silently. Against that, **migration cost** is concrete and front-loaded, and the risk falls on the most valuable suite, the end-to-end regression pack. ## Inventory before deciding Count, per suite, the features that translate mechanically against those that need redesign: | Feature in the TestNG suite | JUnit Jupiter translation | Cost | |---|---|---| | `groups` | `@Tag` plus filters | low | | `@DataProvider` | `@ParameterizedTest` with `@MethodSource` | low | | `invocationCount`, `timeOut`, `enabled` | `@RepeatedTest`, `@Timeout`, `@Disabled` | low | | `dependsOnMethods` chains | no equivalent; restructure flows | high | | `testng.xml` `@Parameters` per environment | configuration parameters or properties | medium | | `@Factory` per browser or tenant | `@ParameterizedClass` (experimental in JUnit 6.1) or restructuring | medium to high | | `IRetryAnalyzer`, custom listeners | extensions | medium | | shared-instance state across methods | redesign for per-method instances | high | A suite dominated by the low rows is cheap to move; one dominated by the high rows is effectively a rewrite. ## Options a lead can choose from 1. **Status quo with shared conventions.** Keep both runners, standardise result files, naming, assertion library and CI layout. Cheapest; leaves the skills cost. 2. **Default for new code, freeze the old.** New tests in JUnit Jupiter, the TestNG suite maintained but not grown, with a written trigger for migrating it (a UI rewrite, a framework upgrade that forces change, the suite owner leaving). The most common outcome. 3. **One launch, two engines.** Run TestNG classes through the JUnit team's TestNG engine on the JUnit Platform beside Jupiter, so tooling sees one launch. Worth checking first that the suite-file-driven features the pack depends on carry over. 4. **Full migration.** Justified when the inventory is mostly low-cost rows, or when the TestNG suite is being rewritten anyway. 5. **Standardise on TestNG.** Rare for backend code, but defensible for an organisation that is mostly end-to-end suites built around suite files. ## How I would make and defend the call - **Decide on evidence.** The inventory, the time engineers lose switching contexts, and how often shared test code is duplicated. - **Do not migrate a working regression pack purely for uniformity.** The risk is silent coverage loss: dependency skips becoming failures, excluded groups running, instance state vanishing. - **Set the rule for new code explicitly**, and record it as a decision with the reasoning, so it is not re-argued with each new hire. - **Write the migration trigger down**, not a date, so a frozen suite does not become a forgotten one. - **Consider the Java baseline.** JUnit 6 requires Java 17 while TestNG 7.12 needs only Java 11; a service stuck on an older runtime constrains the target. ## What a strong answer avoids - Treating "standardise" as obviously right or wrong. - Assuming JUnit Jupiter lacks data-driven or parallel support, or that TestNG cannot be hosted on the JUnit Platform. - Relying on one runner executing the other's tests: TestNG's JUnit support was withdrawn, and a mixed codebase is safer on a platform built for several engines.
- What evidence would make you approve a full migration of the TestNG Selenium suite?An inventory dominated by mechanical features, such as groups, data providers and timeouts, with few dependency chains, little shared instance state and no heavy reliance on suite-file parameters; plus a concrete benefit, such as shared extensions or one onboarding path. A planned rewrite of the UI layer is also a natural moment, since the tests are changing anyway.
- If you keep both runners, what do you standardise so the split costs less?The things people touch daily: one result-file format feeding one CI view, one assertion style and library, one naming scheme, one place for environment configuration, and a written rule for which runner new tests use. With those fixed, the remaining cost is mostly the two annotation models, which a short internal guide covers.
- Always migrate everything to one runner, because uniformity outweighs migration cost
- Never mix runners; a second framework is a defect regardless of its use
- Keep running JUnit tests inside TestNG to avoid choosing at all
- A TestNG suite can never run on the JUnit Platform beside Jupiter tests
- Migration cost is just renaming annotations, so it is trivially cheap
Assumes TestNG 7.12 and JUnit 6.1; TestNG removed its JUnit 3/4 runner support in 7.10.0, and JUnit's @ParameterizedClass is still experimental in 6.1.