Skip to content

rieckpil/java-testing-toolbox

Repository files navigation

Hands-On Introduction to the Java Testing Ecosystem

 Book Cover

This repository contains the source code for the book 30 Testing Tools & Libraries Every Java Developer Must Know.

About the Book

Testing is a critical part of software development, and having the right tools can make all the difference.

This book introduces you to 30 essential testing tools and libraries, carefully selected to cover a wide range of testing needs—from unit testing and assertions to mocking, integration testing, and performance testing.

Each tool is presented in a cookbook-style format, with clear explanations and hands-on examples that you can apply directly to your projects.

What You'll Learn

  • Enrich your testing toolbox with 30 carefully curated tools and libraries.
  • Choose the right tool for the job by understanding the strengths and use cases of each.
  • Explore the Java testing ecosystem through practical, real-world examples.
  • Apply testing best practices to your Spring Boot, Jakarta EE, or any Java application.
  • Gain hands-on experience with each tool through dedicated examples and exercises.

Current Status

Maven Build

The book is now complete with 30/30 tools and libraries covered.

You can grab your copy here.

Repository Overview

This repository contains the source code for the examples used in the book. The examples are organized into two projects:

  • spring-boot-example: Demonstrates testing tools and libraries in the context of a Spring Boot application. You'll find most of the code examples here.
  • jakarta-ee-example: Showcases testing tools and libraries using a Jakarta EE application.

Each tool and library has its dedicated Java package within the spring-boot-example/src/test/java/de/rieckpil/blog directory of the respective project.

The only exception is MicroShed Testing, which is part of the jakarta-ee-example project.

Build & Test

Requirements:

  • Java 21: Verify with java -version
  • A running Docker engine: docker info

Build the project and run all tests with:

cd spring-boot-example
./mvnw verify

cd jakarta-ee-example
./mvnw verify

Covered Test Frameworks

  • JUnit 4
  • JUnit 5
  • TestNG
  • Spock

Covered Assertion Libraries

  • AssertJ
  • JsonPath
  • Hamcrest
  • XMLUnit
  • JSONAssert
  • REST Assured

Covered Mocking Frameworks

  • Mockito
  • WireMock
  • MockWebServer

Covered Test Infrastructure

  • Testcontainers
  • LocalStack
  • MicroShed Testing
  • GreenMail
  • Selenide
  • Selenium

Covered Behavior Driven Testing (BDT)

  • JGiven

Covered Utility Libraries

  • Pact
  • Diffblue
  • Pit
  • Instancio
  • ArchUnit
  • Awaitility

Covered Performance Testing Tools

  • Gatling
  • ApacheBench
  • JMH
  • JfrUnit