-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Feature and motivation
There are currently no instructions in the Test Runners section for Java. I would like to add the following:
Install and execute JUnit 5 test runner using a build tool.
Maven
In the project’s pom.xml
file, specify the dependency:
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId
<version>5.10.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
and specify the build plugin:
<plugin>
<artifactId>maven-surefire-plugin</artifactId
<version>3.1.2</version>
</plugin>
Now, run your tests using:
mvn clean test
Gradle
In the project's build.gradle
file, specify the dependency:
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
and add the following in the test
task:
useJUnitPlatform()
Now, run your tests using:
gradle clean test