Slides, examples, and exercises for a JUnit 5 Workshop, initially held by Marc Philipp and Nicolai Parlog at JUG Karlsruhe on January 25th 2017.
- introduction (Nicolai, 45 minutes)
- setup
- basic features (
@Test
, lifecycle, ...) - simple tasks to write some tests
- dynamic tests (Marc, 30 minutes)
- extension mechanism (theory; Nicolai, 15 minutes)
30 minute break
- extension mechanism (practice Nicolai, 30 minutes)
- architecture. modularization, side-by-side use of JUnit 4 and 5 (theory; example; Marc, 15 minutes)
- roadmap to GA (theory; Marc, 10 minutes)
- Q & A & more hacking, open end...
First, clone the project:
git clone https://github.com/junit-team/junit5-workshop.git
JUnit-5-specific plugins for Maven Surefire and Gradle are included in the project's pom.xml
and build.gradle
so both tools work without additional setup.
Try it with mvn clean test
or gradle test
. Alternatively, you can use the provided Gradle or Maven wrappers with ./mvnw clean test
or ./gradlew test
.
IntelliJ is the first (and so far only) tool that has native support and everything should work out of the box. Since this project uses JUnit 5 Milestone 4 2017.1.2 is required to run the tests.
Eclipse requires a little fiddling to get to work but it is possible with 4.7 M4, following these steps.