JUnit 5 Cookbook
JUnit 5 Cookbook
$7.99
Minimum price
$7.99
Suggested price
JUnit 5 Cookbook

This book is 100% complete

Completed on 2018-12-13

About the Book

Learn JUnit 5 new features - based on JUnit 5.2.0

  • Assertions
  • Assumptions
  • Tagging and filtering
  • Nested tests
  • Dependency injection
  • Repeated tests
  • Parameterized tests
  • Dynamic tests
  • Test instance lifecycle
  • Extension model
  • JUnit 4 migration
  • JUnit platform

About the Author

Fu Cheng
Fu Cheng

Full-stack software developer and lead software engineer at a healthcare startup.

  • Understanding the Java 7: the Core techniques and best practice (Simplified Chinese edition) covers Java SE 7 new features and deep dive of Java platform core features.
  • Build Mobile Apps with Ionic 2 and Firebase covers building mobile apps using Ionic 2 and Firebase.
  • Exploring Java 9 covers Java 9 module system and other new features.
  • A regular author on IBM developerWorks China and InfoQ China website with more than 50 published technical articles covering various technical topics.

Table of Contents

  • 1. Introduction
    • 1.1 Installation
      • 1.1.1 IDE
      • 1.1.2 Build tools
      • 1.1.3 Gradle
    • 1.2 opentest4j
    • 1.3 Source code
  • 2. Writing Basic tests
    • 2.1 @Test
    • 2.2 @DisplayName
    • 2.3 Assertions
      • 2.3.1 assertTrue
      • 2.3.2 assertFalse
      • 2.3.3 assertNull
      • 2.3.4 assertNotNull
      • 2.3.5 assertEquals
      • 2.3.6 assertNotEquals
      • 2.3.7 assertArrayEquals
      • 2.3.8 assertIterableEquals
      • 2.3.9 assertSame and assertNotSame
      • 2.3.10 assertAll
      • 2.3.11 assertThrows
      • 2.3.12 assertTimeout
      • 2.3.13 assertLinesMatch
      • 2.3.14 fail
    • 2.4 Lifecycle annotations
    • 2.5 Disabled tests
  • 3. Assumptions
  • 4. Tagging and filtering
    • 4.1 @Tag
    • 4.2 Filtering
      • 4.2.1 Gradle
      • 4.2.2 Maven
  • 5. Nested tests
  • 6. Dependency injection
    • 6.1 TestInfoParameterResolver
    • 6.2 TestReporterParameterResolver
    • 6.3 RepetitionInfoParameterResolver
  • 7. Repeated tests
  • 8. Parameterized tests
    • 8.1 Sources of arguments
      • 8.1.1 @ValueSource
      • 8.1.2 @EnumSource
      • 8.1.3 @MethodSource
      • 8.1.4 @CsvSource
      • 8.1.5 @CsvFileSource
      • 8.1.6 @ArgumentsSource
    • 8.2 Argument conversion
  • 9. Dynamic tests
  • 10. Test instance lifecycle
  • 11. Extension model
    • 11.1 Registering extensions
      • 11.1.1 @ExtendWith
      • 11.1.2 Java service provider
    • 11.2 ExtensionContext
      • 11.2.1 Store
      • 11.2.2 Namespace
    • 11.3 Parameter resolver
    • 11.4 Test instance post-processing
    • 11.5 Test execution conditions
    • 11.6 Exception handling
    • 11.7 Test lifecycle callbacks
    • 11.8 Using Store
    • 11.9 Test templates
    • 11.10 Sources of arguments in parameterized tests
    • 11.11 Argument converter
  • 12. JUnit 4 migration
    • 12.1 Use JUnit 4 and 5 runtimes
    • 12.2 Use JUnit Vintage
    • 12.3 Migrate tests
  • 13. JUnit platform
    • 13.1 TestEngine
      • 13.1.1 Discover tests
      • 13.1.2 Execute tests
    • 13.2 Launcher
    • 13.3 Test engine configuration

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Write and Publish on Leanpub

Authors, publishers and universities use Leanpub to publish amazing in-progress and completed books and courses, just like this one. You can use Leanpub to write, publish and sell your book or course as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub