Welcome to Manning India!

We are pleased to be able to offer regional eBook pricing for Indian residents.
All eBook prices are discounted 40% or more!
JUnit in Action, Third Edition
Cătălin Tudose, Petar Tahchiev, Felipe Leme, Vincent Massol, and Gary Gregory
  • MEAP began November 2019
  • Publication in Summer 2020 (estimated)
  • ISBN 9781617297045
  • 525 pages (estimated)
  • printed in black & white
free previous edition included
An eBook copy of the previous edition of this book is included at no additional cost. It will be automatically added to your Manning Bookshelf within 24 hours of purchase.

This is the go-to reference for JUnit 5, for both beginners and experts alike.

Kent R. Spillner
JUnit is the gold standard for unit testing Java applications. Filled with powerful new features designed to automate software testing, JUnit 5 boosts your productivity and helps avoid debugging nightmares. Whether you’re just starting with JUnit or you want to ramp up on the new features, JUnit in Action, Third Edition has you covered. Extensively revised with new code and new chapters, JUnit in Action, Third Edition is an up-to-date guide to smooth software testing. Dozens of hands-on examples illustrate JUnit 5’s innovations for dependency injection, nested testing, parameterized tests, and more. Throughout, you’ll learn how to use JUnit 5 to automate your testing, for a process that consumes less resources, and gives you more time for developing.
Table of Contents detailed table of contents

Part 1: JUnit 5 essentials

1 JUnit jump-start

1.1 Proving it works

1.2 Starting from scratch

1.3 Understanding unit-testing frameworks

1.4 JUnit design goals

1.5 Setting up JUnit

1.6 Testing with JUnit

1.7 Summary

2 Exploring Core JUnit

2.1 Core annotations

2.1.1 The @DisplayName annotation

2.1.2 The @Disabled annotation

2.2 Nested tests

2.3 Tagged tests

2.4 Assertions

2.5 Assumptions

2.6 Dependency injection in JUnit 5

2.7 Repeated tests

2.8 Parameterized tests

2.9 Dynamic tests

2.10 Using Hamcrest matchers

2.11 Summary

3 JUnit architecture

3.1 The concept and importance of software architecture

3.2 JUnit 4 architecture

3.2.1 JUnit 4 modularity

3.2.2 JUnit 4 runners

3.2.3 JUnit 4 rules

3.2.4 Shortcomings of the JUnit 4 architecture

3.3 JUnit 5 architecture

3.3.1 JUnit 5 modularity

3.3.2 JUnit 5 Platform

3.3.3 JUnit 5 Jupiter

3.3.4 JUnit 5 Vintage

3.3.5 The big picture of the JUnit 5 architecture

3.4 Summary

4 Migrating from JUnit 4 to JUnit 5

4.1 The steps between JUnit 4 and JUnit 5

4.2 Needed dependencies

4.3 Annotations, classes and methods

4.4 Rules vs the extension model

4.5 Summary

5 Software testing principles

Part 2: Different testing strategies

6 Tests quality

7 Coarse-grained testing with stubs

8 Testing with mock objects

9 In container testing

Part 3: Working with JUnit 5 and other tools

10 Running JUnit 5 tests from Maven 3

11 Running JUnit 5 tests from Gradle 5

12 JUnit 5 IDE support

13 Continuous integration with JUnit 5

Part 4: Working with modern frameworks and JUnit 5

14 JUnit 5 extension model

15 Presentation layer testing

16 Testing Spring applications

17 Testing Spring Boot applications

18 Testing a REST API

19 Testing database access

Part 5: Developing applications with JUnit 5

20 Test Driven Development with JUnit 5

21 Behavior Driven Development with JUnit 5

22 Implementing a test strategy pyramid with JUnit 5

About the Technology

If you’re a Java developer, you have to learn JUnit, the de facto standard for testing Java applications for over a decade. JUnit 5 is a complete overhaul of this leading Java unit testing framework, filled with new tools that make it easier than ever to write effective tests. JUnit 5 brings more granularity and avoids the need to import an entire library, allows multiple runners to work simultaneously and, best of all, allows developers to make full use of the new language features of Java 8 and beyond.

About the book

JUnit in Action, Third Edition is a fully revised guide to unit testing Java applications with the latest version of JUnit. It’s full of hands-on techniques for solving real-world testing problems, such as using mocks for testing isolation, automating your testing, and test-driven development. You’ll also get to grips with more than just testing tools, thanks author Cătălin Tudose’s testing strategy pyramid, which lays out how to break your testing down into different layers — from unit testing right through to system and acceptance testing. Practical examples demonstrate each new JUnit 5 feature, such as new architecture, as well as nested tests, tagged tests, dynamic tests, and dependency injection. With full coverage of migrating your JUnit 4 applications to JUnit 5, and integrating JUnit with other build tools and continuous integration tools, JUnit in Action sets you on the path to bug-free code.

What's inside

  • Introduction to unit testing
  • Connecting JUnit 5 with build tools such as Maven or Gradle
  • Working with JUnit 5 extensions
  • Develop Test Driven Development and Behavior Driven Development applications
  • Migrating from JUnit 4 to 5

About the reader

For intermediate Java developers.

About the authors

Cătălin Tudose has a PhD in Computer Science, and over 15 years experience as a Senior Java Developer and Technical Team Lead. He works as a Java and Web Technologies Expert at Luxoft Romania, and as a professor at the Faculty of Automation and Computers in Bucharest. Petar Tahchiev, Felipe Leme, and Gary Gregory authored the second edition of JUnit in Action, and Vincent Massol was the author of the first edition.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $59.99 pBook + eBook + liveBook
includes previous edition
MEAP eBook $47.99 pdf + ePub + kindle + liveBook
includes previous edition
Prices displayed in rupees will be charged in USD when you check out.

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks