Created
March 7, 2019 04:14
-
-
Save TheDancerCodes/c2f6a6216046dc4ca4fee6c20017f8d9 to your computer and use it in GitHub Desktop.
Setting Up your Java Project for JUnit 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "java" | |
// Enable the JUnit platform through the test closure; | |
// which has been providing the method useJUnitPlatform since the release of gradle 4.6 | |
test { | |
useJUnitPlatform { | |
includeTags "slow" | |
excludeEngines "my-engine" | |
} | |
} | |
// Add the required libraries to you dependencies block | |
dependencies { | |
// In order to write JUnit Jupiter tests, add the JUnit Jupiter API artifact to be available at compile time & | |
// JUnit Jupiter Engine artifact to be available at runtime | |
testImplemenation "org.junit.jupiter:junit-jupiter-api:5.3.1" | |
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.1" | |
// Backward Compatibility Support; To enhance your existing codebase with JUnit 5 | |
testImplemenation "junit:junit:4.12" | |
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.3.1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment