Simplifying Testing With Advanced JUnit Features

Simplicity is the ultimate sophistication. - Leonardo da Vinci

So far, we have discovered the basics of Jupiter, the brand-new programming model provided by the JUnit 5 framework. Moreover, Jupiter provides a rich range of possibilities which allows to create different types of test cases. In this chapter, we review these advanced features. To that aim, this chapter is structured as follows:

  • Dependency injection: This section first takes a look at dependency injection for constructors and methods in test classes. Then, it reviews the three parameter resolvers provided out of the box in Jupiter. These resolvers allow to inject objects of TestInfo, RepetitionInfo, and TestReporter inside tests. ...

Get Mastering Software Testing with JUnit 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.