Deploy Spring Boot Applications With More Confidence and Less Regressions

Master testing real-world Spring Boot applications with this comprehensive hands-on course

LIMITED OFFER: Receive two free testing-related resources when enrolling for the Masterclass Bundle (additional ebook & online course).

TL;DR: This online course is a deep-dive on effectively writing unit, integration, and end-to-end tests for Spring Boot applications.

Knowing How to Effectively Test Separates the Serious Engineer from a Hobby Developer

“Quality is not an act. It is a habit.” – Aristotle

Do you remember writing your first Spring Boot application? You were excited that you now finally expose data via an API and can connect to a database.

Testing your application was the last thing you could think of at this moment.

Once you start using Spring Boot in a professional environment there is no way around testing. Testing your application gives you confidence, fearless deployments on Friday afternoons and a good night of sleep.

Most tutorials and courses about testing barely go beyond the Hello World example of testing a calculator.

This does not prepare you for the real world where your application faces database access, external systems, messaging system, network, etc.

There are so many great libraries and techniques out there for the Java ecosystem when it comes to testing. Mastering them all, right after you understand the basics about Spring Boot, is hard.

Testing is joyful once you are familiar with all the great tools you have access to: JUnit, Mockito, AssertJ, Hamcrest, JsonPath, JSONAssert, Testcontainers, Selenium, LocalStack, Awaitility, and not to forget the whole Spring Testing support.

Especially with Spring Boot you get so much functionality when it comes to testing. What you need are recipes to tackle testing different parts of your applications and then apply them.

This Testing Spring Boot applications Masterclass is all about making you an expert when it comes to testing Spring Boot applications in an efficient way.

All You Need to Know About Testing
Spring Boot Applications

The number of testing libraries is huge in the Java ecosystem. One might get overwhelmed with all the different solutions. 

This online Masterclass guides you through every testing library you need to verify your Spring Boot application is working as expected.

After working with this course, you not only have recipes at hand to test different parts of your application, but you are also familiar with industry best practice.

Get First-Hand Insights Into the Masterclass

Subscribe to the newsletter and I'll send you four Masterclass preview lessons from different modules to your inbox

Enroll now and never worry about testing your Spring Boot Application again!

NEWS: Up-to-date with Spring Boot 2.7.0 and Java 17


Your Journey to More Confident Releases

Testing Spring Boot Applications Course Map

Here’s What You’ll Learn In Detail

Whether you just started with Spring Boot or are already using it in several projects, this Spring Boot Testing Masterclass guides you through all relevant parts of testing Spring Boot applications.

Understand What and How to Test

You are unsure which parts of your application to test? There is a good chance that you are not focusing on the relevant parts of your application you should test.

Go Beyond Trivial Unit Testing

After working with this course you'll have recipes at hand to test all non-trivial parts of your application like database access, HTTP communication, using cloud services (e.g. SQS from AWS), etc.

Master Different Testing Libraries

Not only will you be able to use all presented testing libraries for your application, but also understand what they are about and when to use which. Knowing when to use which library is a key skill.

Testing Best Practices

This Masterclass includes an own section about industry best practices for testing applications. Make use of knowledge from years of writing tests for enterprise applications.

Here’s What the First Early-Bird Students Say About This Course

Vlad Flore Course Student

Vlad Flore

Softtware Engineer - Homepage

Testimonial on Twitter


Bought it a couple of days ago and had a look at it -> it's awesome! Really like the tech stack and the project looks altogether very professional! Lots of good stuff in there!

Wim Deblauwe Course Student

Wim Deblauwe

Software Engineer - Homepage

Testimonial via Mail


Philip has made a fantastic overview of the full testing landscape of Spring. The videos are clear and explain details and common pitfalls in great depth. Looking forward to the rest of the course.


PS: Wim is also book author of Taming Thymeleaf and Practical Guide to Building an API Back End with Spring Boot.

Siva Course Student

Siva

Software Engineer and Blogger

Detailed review of the Masterclass on his blog


I got an opportunity to review the course I find it wonderful for learning how to test Spring Boot applications leveraging modern testing frameworks and libraries....


I would highly recommend Masterclass for anybody working with Spring Boot applications.


Read the full review here.

Course Curriculum

Overview of the different Masterclass Modules

1

Module 1: Introduction 

We'll start with an application walk-through, to get you familiar with the code base we test throughout the Masterclass.


At the end of this module you'll be able to start the Book Reviewr application and its infrastructure components on your machine.

2

Module 2: Testing With the Spring Boot Starter Test

Getting familiar with the swiss-army knife that every Spring Boot project includes: Spring Boot Starter Test.


We'll cover all testing libraries that come with this starter and take a detailed look into testing with JUnit 5 and mocking with Mockito.

3

Module 3: Testing Database Access

Start writing efficient tests for your database layer while utilizing Spring Boot test features like @DataJpaTest, TestEntityManager, @Sql, etc.

Furthermore, with this module you'll start using Testcontainers to replace the default in-memory database, learn how you can pre-populate your database, and understand the pitfalls when writing tests where the EntityManger is involved.

4

Module 4: Testing the Web Layer

MockMvc to the rescue!


Learn how to effectively test your web-layer (@RestController and @Controller) in isolation. You have your endpoints secured with Spring Security? No problem! There is great support available to ensure only authenticated users with the correct privileges reach your endpoints.

5

Module 5: Testing Further Slices of our Application

Ever wanted to know how to test your WebClient or RestTemplate HTTP calls? How to ensure your business logic is working as expected and how to verify your messaging controllers?


In this module, we'll tackle further slices to effectively test different parts of our application in isolation. In addition, we'll write our own test slice.

6

Module 6: Writing Tests With the Whole Spring Context

It's time to write integration tests using @SpringBootTest!


With the knowledge of previous modules, we can mock almost any external infrastructure component, except Keycloak. We'll introduce WireMock to mock the HTTP interaction with the identity provider or any other system during application startup (e.g. Salesforce, Stripe, SAP, etc.).

7

Module 7: Writing Web Tests

Writing end-to-end tests to ensure users can interact with your application.


Having automated web-tests for your happy-paths can literally save your ass. We'll make the most of Selenium and Selenide by verifying the Book Reviwr application without any manual WebDriver setup (including VNC recording, screenshots on failure, etc.).

8

Module 8: Testing Best Practices

Build tool configuration, test strategies, naming strategies, testing static methods, working with time, test report visualization within your CI (e.g. Jenkins, GitLab CI, Azure DevOps) server, etc.


... and last but not least: Drastically reduce your build times with Spring's Context Caching mechanism.


Talk Is Cheap, Show Me Some Real Lessons!

Follow him on:

Your The Course Instructor:

Philip (rieckpil)

Philip is an independent IT consultant living in Berlin. He started working with Java back in 2015 and has used it together with Spring Boot for multiple applications in several industries. Testing is an integral part of his daily work as he is a profound craftsman.

Once Philip understood the ins and outs of the Java testing landscape, writing tests makes as much fun as writing production code for him. He's a won around TDD (Test Driven Development) practitioner and regularly shares testing techniques among his colleagues and clients.

He started teaching Java topics on YouTube in 2018 and is writing content about the Java ecosystem on his blog since 2017.

More than 10.000 course students have enrolled for his online courses. Besides that, he's also actively helping developers on Stack Overflow with their questions around testing Java applications.

Here’s What People Are Saying About the Course Instructor

Tom Hombergs reflectoring.io

Tom Hombergs

Founder of reflectoring.io

Philip is a dedicated developer and doesn't give up until he has understood the details of a topic.


In his courses and articles, he transfers this knowledge to you and they leave you smarter than before. 


Looking forward to working with you in the future, Philip

Vlad Mihalcea

Vlad Mihalcea

Founder of vladmihalcea.com

Philip is a very skilled content creator who managed to publish high quality articles and videos that cover a wide range of topics, like Spring, Java EE, or Jakarta EE.


He pays a lot of attention to details, so if you enjoyed his articles and videos, you are surely going to love his video courses.

Marco Behler

Marco Behler

Founder of marcobehler.com

How can you not love what Philip is doing?


Tons of actionable tutorials and content across the Jakarta EE and Spring universes.


Highly recommended!

Why You MUST Invest Time in Learning How to Test Spring Boot Applications

When was your last outage or downtime caused by a bug that could have been prevented with a test? How much did your company lost in direct revenue or indirectly by losing customer satisfaction? How less productive are you and your coworkers because of missing automated tests?


Putting in numbers is hard, but I guess every minute a non-trivial application is not working as expected results in costs or lost revenue of $100.000+.


On the other side, consider how uncertainty paralyses you when you want to refactor an existing code base that lacks tests. Or you are new to a project and want to introduce a new feature. Testing things afterwards manually is a cumbersome and repetitive tasks. 


We, as engineers, are lucky to have tools around us that can automate such cumbersome and repetitive tasks. So let's start using them by learning how to effectively test our applications.


Once you know your testing toolkit, writing tests becomes joyful.


Course Curriculum

Introduction to the Masterclass

Welcome

3

Getting Started

Keeping the Course Content Up-to-Date

Changelog

Application Setup

2

Setup for Java Development

Infrastructure Setup With Docker Compose

Application Walkthrough

8

Application Architecture

Maven Dependencies

Flyway Migration Scripts

Application Configuration

AWS SDK Overrides

Introduction to the Backend Code

Keycloak Configuration Walkthrough

Application Walkthrough

Testing With the Spring Boot Starter Test

Introduction to the Spring Boot Starter Test Dependency

2

Anatomy of the dependency

Managing library versions

Introduction to JUnit 5

9

Writing Your First Test With JUnit 5

Verify the Test Outcome With Assertions

Lifecycle of a Test

More on Assertions

Specifying the Name of a Test

Write Parameterized Tests

Your First JUnit 5 Extension

Happy-Path Testing

Parallelization of Tests

Introduction to Mockito

7

Introduction to the Class Under Test

Mocking Method Calls With Mockito

Your First Test With Mockito

Mocking the Behaviour of the Repository

Instrumenting a Mock to Throw an Exception

Full Happy-Path Test With Mockito

Capture Method Arguments and Verify Invocations

Additional Test Libraries of the Starter

4

Introduction to Hamcrest

Introduction to AssertJ

Introduction to JSONAssert

Introduction to JsonPath

Testing Database Access

The Secret Weapon to Test Your Database Layer: @DataJpaTest

8

Introduction to the JPA Domain Model

What to Test When Using Spring Data JPA

Start Using @DataJpaTest

Resolving context startup errors

Why and When to Use the TestEntityManager

Pitfalls of the First Level Cache

Transactional Support

Using P6SPY for More Insights

Replacing the In-Memory Database

7

The Rationale Behind Not Using In-Memory Databases

Using Testcontainers for the First Time

Managing the Lifecycle of a Container

Improve Build Times by Reusing Containers

Solutions to Pre-Populate Your Database

Testing the Native Query

Recap of the Database Access Module

Testing the Web Layer

The Secret Weapon to Test Your Web Layer

6

Why Unit Tests Are Not Enough

Introduction to @WebMvcTest

Getting the Setup Right

Defining On Which Level to Mock

Your First Test With @WebMvcTest

More Tests for the BookController

Advanced Usage

8

Introduction to the ReviewController

Verifying the First Behavior

Testing the First Secured Endpoint

Additional Ways to Provide Authentication

Happy-Path Testing For Creating Reviews

Ensure We Validate Incoming Reviews

Access to Role-Based Secured Endpoints

Recap and Learnings of This Module

Testing Further Slices of Our Application

Testing HTTP Clients Using the RestTemplate

7

Introduction to Testing HTTP Clients

The Power of @RestClientTest

First Test Using the MockRestServiceServer

More Assertions for the Happy-Path

Handling Partial Responses

Test a Failure of the Remote System

More Expectations on the HTTP Request

Testing HTTP Clients Using the WebClient

5

Required Setup for the MockWebServer

Testing the Happy-Path Using MockWebServer

Verify Behavior on Partial Responses

Testing Failure of the Remote System

Implement and Test Retry Mechanism for More Resiliency

Testing Business Logic in Isolation

5

Which Logic to Verify

Getting the Setup Right for Testing the ReviewService

Verify the First Error Scenario

Ensure We Don't Store Reviews With Bad Quality

Happy-Path Testing For Storing a Review

Testing a Custom Application Slice

8

Choosing the Application Part for Isolated Testing

Introduction to LocalStack

Creating a Spring Application Context With Only One Message Listener

Understanding the Spring Cloud AWS Auto Configuration

Overriding the AWS SQS Client

Creating a Local SQS Queue and Applying the Configuration

Happy-Path Testing For the Whole Listener Process

Recap on How to Create a Sliced Spring Context for Testing

Writing Tests With the Whole Spring Context

Remaining Setup to Start the Whole Spring Boot Application

9

What's Currently Missing to Start the Whole Context

Creating an Integration Test Profile

First Try to Start the Whole Context

Introducing WireMock to Mock HTTP Communication

Creating an ApplicationContextInitializer for WireMock

Mocking the OpenID Configuration Response

Mocking the JWKS (JSON Web Key Set) Response

Making Use Of the WebTestClient to Access the Backend

Creating a Valid JWT to Access Our Endpoints

Writing Integration Tests for Our Application

7

Verifying the Book Synchronization Process

Refactor Our WebClient to Mock the HTTP Response

Extract Integration Test Setup to a Central Place

Ensure Users Can Create Reviews

Develop the Missing API Endpoint Test-Driven (TDD)

Test the Statistics Endpoint With Reviews From Multiple Users

Recap of This Module About Integration Tests

Writing Web Tests

Providing the Whole Application Infrastructure

9

What's Missing Compared to Writing Integration Tests

Creating a Web Test Application Profile

Using Testcontainers to Start the Docker Compose Environment

Using Selenide to Write Concise Web Tests

Writing the First Test With Selenide

Making Screenshots During Test Execution

Further Hints on the Web Test Setup

Using Testcontainers With Selenide

Recording the Web Test With a Video

Test the Happy-Path User Journey

4

Inserting Reviews During the Web Test

Verifying the Outcome of the Test

Refactoring the Test to Page Objects

Recap on Writing Web Tests

Testing Best Practices

Naming and Test Strategies

2

Defining Your Own Test Strategy

Naming Conventions for Your Tests

Build Tool Configuration

2

Maven Surefire and Failsafe Plugin Configuration

Visualizing Test Results Within a CI Server

Reduce Build Times With Spring's Context Caching

3

Introduction to Context Caching

Context Caching in Action

Making the Most Of Spring's Context Caching

General Testing Advices

3

Working With Time

Mocking Static Method Calls

Using GitHub Actions for Your Project

Next Steps

Thank You for Completing the Masterclass

Claim Your Certificate (TSBAM)

Detailed Module Overview

Discover what we're discussing in the eight modules of the Testing Spring Boot Applications Masterclass.

1
  • Course application walk-through (Book Reviewr)
  • Understand the AWS setup for this application
  • Get to know the OAuth2 setup of the application using Keycloak
4
  • Effectively test your web-layer in isolation using @WebMvcTest
  • Test protected controller endpoints with ease
  • Write tests against a mocked Servlet environment using MockMvc
7
  • Get rid of manual WebDriver setup efforts (Testcontainers & Selenide)
  • Record the web test and make screenshots on-demand
  • Start a Docker Compose environment for your end-to-end test
2
  • Discover all testing libraries that the Spring Boot Starter Test includes
  • Getting started with JUnit 5 (parallelization, custom extensions, etc.)  
  • Writing assertions for JSON payloads using JSONAssert & JsonPath
5
  • Write tests for HTTP clients (e.g. WebClient or RestTemplate)
  • Testing business logic in isolation
  • Write custom test slices e.g. for the SQS subscriber and include only relevant beans to the Spring Test Context 
88
  • General tips & tricks around testing
  • Making the most of Spring's Context caching to speed up your tests
  • Practical advice for your test structure & naming conventions
3
  • Writing isolated tests for your database layer using @DataJpaTest
  • Pitfalls when writing tests with the EntityManger
  • Use Testcontainers to write tests against your database
63
  • Mock components that are required during application startup (e.g. identity provider, Salesforce, external APIs, etc.)
  • How to structure and what to write  integration tests for 
  • Mock Keycloak or any other OAuth2 identity provider

What this Masterclass Is All About

This Masterclass is ...

  • An in-depth course on testing Spring Boot applications
  • Your go-to resource for hands-on unit, integration, and end-to-end testing recipes and best practices
  • A comprehensive guide on how to use testing tools and libraries for testing modern microservices

The Masterclass is not ...

  • A course on developing microservices
  • A course on masterting TDD (find recommended resources here)
  • A course on testing or developing frontend applications

The Masterclass in Numbers

8

Modules

130+

Course Lessons

10h+

On-Demand Video Content

The real-world Book Reviewr Course Application

A central goal of this online course is to teach testing Spring Boot applications based on a real-world application

Everyone can teach unit testing by testing a MyCalculator Java class. Things get difficult once you have to write integration tests that interact with infrastructure like databases or external systems.

We won't develop the course application from scratch as we're focussing on writing automated tests for it.

  • Self-contained system with Spring Boot (Java) & a SPA with React (TypeScript)
  • Domain: Entering reviews for books, getting review statistics and managing reviews
  • Interaction with a database (PostgreSQL), a messaging queue (Amazon SQS), and a remote system (HTTP)
Book Reviwer Technical Architecture
  • The testing recipes can be applied to any other database or messaging queue
  • Focus on today's microservice-based architectures
  • Covering tests with OAuth2, OpenID Connect, Spring Security, Keycloak, etc.

Deploy Changes with Confidence

Below you see one of the final end-to-end tests we're going to write to verify the most important user journey of the Book Reviewr application.

Testcontainers VNC Recording End-to-End test
Write Meaningful Tests

There's a lot of cargo cult when it comes to testing. With this course, you'll learn which parts of your Spring Boot application you need to cover with unit, integration, and end-to-end tests.

Hands-On Testing for Real-World Applications

The current trend toward microservice-based architectures and cloud deployments brings more challenges for effectively testing our application. You'll learn various testing patterns that you can immediately apply to your day-to-day projects.

Best Practices & Testing Recipes

Enrich your skillset as a software developer and become a more valuable team member by learning the best practices and recipes for testing Spring Boot applications.

ONLINE COURSE EDITION

Advanced testing online course with real-world examples.

$189

Single-User License

plus VAT (where applicable)

  • 130+ English video lessons: 10h+ content with English subtitles
  • Lifetime access to all eight modules of the Masterclass
  • Certificate of Completion
  • Unit testing techniques and best practices for Spring Boot Applications
  • <