JUnit 5 extensions: from conditional test execution to test templates

Day 2 / 14:00  / Track 1  / Lang: EN

Attention! To fully understand everything Marc will tell us in this talk, we strongly encourage you to watch his previous talk "JUnit 5 — The New Testing Framework for Java and Platform for the JVM": https://www.youtube.com/watch?v=751gMXH-lEE

JUnit 5 has finally arrived! It introduces a completely new extension model that allows to customize almost every aspect of test execution.

For example, it lets you define custom conditions to decide whether a test should be executed or skipped. Test lifecycle callbacks allow to encapsulate common setup/teardown code in an extension. An extension can pass values or inject dependencies to a test by post-processing test instances, or resolving test method parameters. Moreover, you can even write an extension that specifies how a test method becomes a template for multiple tests and how to invoke those, e.g. multiple times with different parameters or a different setup.

In this talk, we will go on an example-driven tour of the new extension API using real-world testing scenarios. We will learn about the utilities an extension can use, e.g. how it should store state, so you will be ready to write your own extensions after this session.

The talk will be interesting for experienced Java developers with prior knowledge of JUnit (at least JUnit 4)



Marc Philipp

Marc Philipp, LogMeIn

marcphilipp

Marc Philipp is a software engineer who works on cloud-based SaaS products for LogMeIn in Karlsruhe, Germany. He is a long-time core committer and maintainer of JUnit and initiator of the JUnit Lambda crowdfunding campaign that started what has become JUnit 5.