Testing / JUnit6 Interview Questions
What modules were removed in JUnit 6 and why?
JUnit 6 removed several modules that had been deprecated in earlier JUnit 5.x releases. Knowing what was removed and its replacement is a common interview topic.
| Removed module | What it did | Replacement |
|---|---|---|
| junit-platform-runner | JUnit 4 @RunWith-based runner that could run JUnit Platform tests on JUnit 4 engines | Migrate to native JUnit 6 engine; use Maven Surefire 3.x or Gradle's JUnit Platform support directly |
| junit-platform-jfr | Provided custom Java Flight Recorder (JFR) events for test discovery and execution | JFR integration is now built into the launcher itself -- no separate module needed |
| junit-platform-suite-commons | Internal helper module for test suite support | Functionality merged into junit-platform-suite |
| junit-jupiter-migrationsupport | Compatibility layer for JUnit 4 @Rule adapters in JUnit 5 | Deprecated in JUnit 6.0.0; will be removed in the next major version |
| junit-vintage-engine (deprecated, not removed) | Runs JUnit 3/4 tests on the JUnit Platform | Still present but deprecated; remove JUnit 3/4 tests or use an interim Vintage dependency |
<!-- BEFORE (JUnit 5 with platform runner) --> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-runner</artifactId> <!-- REMOVED in JUnit 6 --> <scope>test</scope> </dependency> <!-- AFTER (JUnit 6): use Maven Surefire 3.x directly --> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>3.3.0</version> <!-- Maven Surefire 3.x required for JUnit 6 --> </plugin> <!-- Surefire 3.x discovers JUnit Platform tests natively without needing junit-platform-runner --> <!-- jupiter-migrationsupport: deprecated but still present in 6.0.x Remove before JUnit 7 ships --> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-migrationsupport</artifactId> <!-- DEPRECATED --> <scope>test</scope> </dependency>
More Related questions...