Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is JUnit5 Platform Launcher exactly?

Tags:

maven

junit5

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?

Junit (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>
like image 739
Code Complete Avatar asked Mar 23 '19 10:03

Code Complete


1 Answers

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.

like image 75
johanneslink Avatar answered Oct 28 '22 09:10

johanneslink