Testing / JUnit6 Interview Questions
What is the JUnit 6 architecture and what are its three main components?
JUnit 6 retains the three-tier architecture introduced in JUnit 5, with one key change: all three components now share a single unified version number instead of having separate version schemes.
| Component | Artifact prefix | Role |
|---|---|---|
| JUnit Platform | junit-platform-* | Foundation: defines TestEngine SPI, launcher API, and the mechanism for discovering and executing tests. IDEs and build tools integrate at this layer. |
| JUnit Jupiter | junit-jupiter-* | Writing tests: provides all annotations (@Test, @BeforeEach, @ParameterizedTest, etc.), assertions, and extension APIs used by developers writing tests. |
| JUnit Vintage | junit-vintage-* | Legacy: runs JUnit 3 and JUnit 4 tests on the JUnit Platform. Deprecated in JUnit 6 -- will be removed in a future major version. |
<!-- Maven BOM: single version for all modules in JUnit 6 --> <dependencyManagement> <dependencies> <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> <version>6.1.1</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <scope>test</scope> <!-- Version resolved by BOM: 6.1.1 --> </dependency> </dependencies> <!-- JUnit 5 used different version numbers: Platform: 1.x.x Jupiter: 5.x.x Vintage: 5.x.x JUnit 6: all three use 6.x.x -->
Key change from JUnit 5: in JUnit 5, the Platform used version 1.x.x while Jupiter and Vintage used 5.x.x. This caused confusion in dependency management. JUnit 6 unifies all three under the same 6.x.x version, making BOM usage straightforward and eliminating version mismatch errors.
More Related questions...