JUnit 5 is modular.
I understand that everything is based on Platform Module (junit-platform-engine-1.3.2.jar
):
Jupiter Module (API + engine parts: junit-jupiter-engine-5.3.2.jar
+ junit-jupiter-api-5.3.2.jar
) and
Vintage Module (API + engine parts: junit-vintage-engine-5.3.2.jar
+ junit-4.12.jar
and hamcrest-core-1.3.jar
) both use Platform Module as the basic one.
But what is the Platform Launcher and when is it needed?
When and why may I need it and how to add it to pom.xml
?
(picture is courtesy of this link)
Adding Jupiter (for JUnit 5 tests only) and Vintage (for Junit4/Junit3 compatibility - to run legacy JUnit4 tests from JUnit5) to pom.xml is like this (just for future reference):
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<!-- Vintage Module to run JUnit4 from JUnit 5 -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
You only need the launcher when you want to start a JUnit platform run programmatically, i.e. outside an IDE, build tool or console runner.
In other words: the launcher is the API being used by IDEs and build tools.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With