Testing / JUnit6 Interview Questions
What are the unified version changes in JUnit 6 and why do they matter for dependency management?
One of the practical improvements in JUnit 6 is the adoption of a single unified version number across all three components. In JUnit 5, the components used different version schemes, causing widespread confusion and dependency conflicts.
| Component | JUnit 5 versions | JUnit 6 versions |
|---|---|---|
| JUnit Platform | 1.0.x through 1.11.x | 6.0.x through 6.x.x (same as others) |
| JUnit Jupiter | 5.0.x through 5.11.x | 6.0.x through 6.x.x (same as Platform) |
| JUnit Vintage | 5.0.x through 5.11.x | 6.0.x through 6.x.x (same as Platform) |
<!-- JUnit 5: confusing mixed versions --> <!-- Correct combination for JUnit 5.11.4: --> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-engine</artifactId> <version>1.11.4</version> <!-- Platform uses 1.x.x --> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.11.4</version> <!-- Jupiter uses 5.x.x --> </dependency> <!-- Common mistake: using 5.11.4 for Platform (wrong!) --> <!-- or 1.11.4 for Jupiter (also wrong!) --> <!-- JUnit 6: all use the same version --> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-engine</artifactId> <version>6.1.1</version> <!-- same version --> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>6.1.1</version> <!-- same version --> </dependency> <!-- BOM still recommended to avoid managing versions at all --> <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> <version>6.1.1</version> <type>pom</type><scope>import</scope> </dependency>
More Related questions...