What Happened

Select a session to learn more about it.

  • Boni García
  • A Deep Dive into JUnit 5
    Boni García
    99 Minute Workshop

    A Deep Dive into JUnit 5


    99 Minute Workshop


    Version 5 of the popular testing framework JUnit was first released in September 2017. Since then, JUnit 5 is in constant evolution and maintenance. It has been designed using a modular architecture made up of three main components:

    • Platform: Foundation component providing generic capabilities to discover and execute test cases in a Java Virtual Machine (JVM).
    • Vintage: Engine for legacy tests (JUnit 3 and 4).
    • Jupiter: Engine for the new programming and extension model.

    Jupiter tests can be executed using a build tool such as Maven, Gradle, or Ant. Besides, modern Integrated Development Environments (IDEs) such as IntelliJ IDEA, Eclipse, or Visual Studio, are shipped with built-in capabilities to execute JUnit tests out of the box.

    Java annotations are one of the main building blocks of the Jupiter programming and extension model. For instance, we can specify the logic to exercise and verify a System Under Test (SUT), i.e., a test case (or simply test), using the annotation @Test at method-level in a Java class. Other basic annotations to define the rest of the basic test lifecycle are @BeforeEach/@BeforeAll (setup logic, executed before the test) and (@AfterEach/@AfterAll (teardown logic, executed after the test). When coming to data verification, Jupiter provides a rich API for assertions (e.g., assertTrue, assertFalse, assertEquals, assertArrayEquals, among many others). Besides, we can use a third-party advanced assertions library in conjunction with Jupiter, for example, Hamcrest, Truth, or AssertJ, to name a few.

    Jupiter provides a wide variety of additional features to develop different types of tests. In this workshop, we review some of the most relevant.

    Finally, we introduce the extension model of Jupiter. An extension in Jupiter is a Java class that allows developers to incorporate extra features to Jupiter. The building block of the Jupiter extension model is the so-called extension points., such as:

    Learning Outcomes

    • Tagging and filtering: Label and execute a group of tests
    • Timeout: Specify a configurable time for a test to fail
    • Test order: Specify a given execution order for tests
    • Parameterized tests: Implement data-driven tests
    • Parallel execution: Use a thread-pool to execute a test suite in parallel
    • Lifecycle callbacks and test instance postprocessing: to enhance the default test lifecycle with custom logic
    • Conditional test execution: to custom enable/disable tests
    • Parameter resolution: to implement dependency injection in tests
    • Exception handling: for custom exception manipulation


    Knowledge requirements:

    • Basic knowledge of Java language.

    Software requirements:

    • Java 8+ (JDK preferred).
    • Some modern IDE such as Eclipse, IntellijIDEA, Visual Studio, or NetBeans.
    • To clone/fork the code examples GitHub repo: https://github.com/bonigarcia/mastering-junit5
    • A build tool such as Maven or Gradle (optional).


    Boni García
    Boni García
    Visiting Professor
    I am Visiting Professor at Universidad Carlos III de Madrid (UC3M) in Spain. My research interests include software engineering and automated testing. I am the author of more than 35 research papers in different journals, magazines, and international conferences. In 2017 I wrote the book "Mastering Software Testing with JUnit 5". I am the creator and maintainer of several open-source projects, such as WebDriverManager (a helper library for Selenium WebDriver) or Selenium-Jupiter (a JUnit 5 extension for Selenium WebDriver).

    Frequently Asked Questions

    Are the Workshops Recorded?

    Our 99-minute workshpos are designed to be attended live. If you can’t make the scheduled time, it will stay available to replay in CrowdCast for 7 days. To get the most out of them, we highly recommend you attend them live.