JUnit 5 at Devoxx US 2017

A few weeks ago, I attended Devoxx US in San Jose, CA, and gave a talk about JUnit 5. The recording is now available on YouTube.

Abstract

Over the last decade a lot has happened in the world of Java and testing, but JUnit 4 hasn’t kept up. Now JUnit 5 is here to help shape the future of testing on the JVM with a focus on Java 8 language features, extensibility, and a modern programming API for testing in Java. Moreover, JUnit isn’t just a Java testing framework anymore. Third parties are already developing test engines for Scala, Groovy, Kotlin, etc. that run on the new JUnit Platform.

In this session, we will start off with an overview of the inspiration for and architecture of JUnit 5, from launchers to test engines. Then, we will take an example-driven tour of the new Jupiter programming model. We will explore the Jupiter extension model, learn about the extension points it provides, and see how custom extensions for conditional tests, method parameter resolution, lifecycle callbacks etc. are authored and registered. To round off the session, we will discuss migration strategies and compatibility with JUnit 4 and look at the roadmap of what’s still to come.

Code Examples

The complete example code is available on GitHub.

class SimpleTest {

    @Test
    @DisplayName("1 + 1 = 2")
    void myFirstTest() {
        assertEquals(2, 1 + 1);
    }

    @Test
    @Disabled("for some reason")
    void anotherTest() {
        assertEquals(0, 1 + 1);
    }
}

Slides

The slides are available on SpeakerDeck.

blog comments powered by Disqus