It has been months that I have been searching for real-world examples where I can see how TDD is applied in practice with Spring. This is probably the best resource that I got in this regard. All other resources talk about building calculator with TDD and that does limited help when building web applications.
Deploy Spring Boot Applications With More Confidence and Fewer Regressions
Learn How to Master Automated Testing and Become More Productive & Confident with the Testing Spring Boot Application Masterclass
Before taking this Online Course
After taking this 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 to become more confident and productive.
Anniversary Offer: 30% Discount & Free TDD with Spring Boot Done Right Course Enrolment
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.
Watch Four Preview Lessons of 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! All content is up-to-date with Spring Boot 3 and Java 21.
Anniversary Offer: 30% Discount & Free TDD Course Enrolment
Your Journey to More Confident Releases
Stop The Firefighting Mode
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 Course Students Say About This Masterclass
Wim Deblauwe
Software Engineer - Homepage
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.
Anton Ždanov
Full Stack Developer - LinkedIn
For me testing a Spring application seemed like a challenge involving digging through numerous blog posts, documentation for JUnit, Mockito, and Spring Testing Reference which provide valuable information but are spread out and don't necessarily show the best practices.
After watching the Testing Spring Boot Applications Masterclass course I feel more confident in writing different types of tests for my apps. The course, videos, and the GitHub repository were of invaluable use to me demonstrating various testing mechanics the Spring ecosystem provides, and I will keep referencing the course materials in the future.
The application that is tested in the course is quite complex and covers a lot of real-world testing challenges one might encounter, which I found immensely useful for seeing the bigger picture.
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.
What You'll Learn
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.
Your The Course Instructor:
Philip
Philip works as an independent IT consultant in Germany. He started working with Java back in 2015 and I used Spring Boot ever since. Automated testing was always one of his biggest pain points as he didn't know how to tackle is.
As of today, testing is an integral part of his daily work.
Philip is teaching Java topics on YouTube since 2018 and is writing content about the Java ecosystem on my blog since 2017.
More than 10.000 course students have enrolled his my online courses. Besides that, he's also actively helping developers on Stack Overflow (10k+ reputation) with their questions around testing Java applications.
Once he understood the ins and outs of the Java testing landscape, writing tests makes as much fun as writing production code for me. He's a won around TDD (Test Driven Development) practitioner and regularly share testing techniques among my colleagues and clients.
Philip's Recent Spring Boot Testing Conference Talks
Learn More About the Course Instructor and Spring Boot Testing Expert Philip
Things I Wish I Knew When I Started Testing Spring Boot Applications
Testing is an integral part of software development, and unfortunately, some teams treat this topic neglectfully.
This talk will give you an overview of best practices, pitfalls, and recipes for testing Spring Boot applications.
Philip shares the things that he wish he had known when he started testing Spring Boot applications.
Watch the talk on YouTube.
How Fixing a Broken Window Cut Down Our Build Time
By 50%
Our journey of getting rid of @DirtiesContext on top of an abstract test class (aka. the "broken window") that made reusing the Spring TestContext impossible and resulted in ever-growing build times.
After fixing this "broken window", our overall build time went down by 50% from 25 to 12 minutes.
Watch the talk on YouTube.
Here’s What Other Content Creator Are Saying About the Course Instructor
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
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
Founder of marcobehler.com
How can you not love what Philip is doing?
Tons of actionable tutorials and content across the Spring universes.
Highly recommended!
Testimonials from Course Finisher
This is a very nice course, I learnt a lot about different test slices. I can't wait to take the master class course
Yemi
This course is quite dangerous as it will leave you expecting the same level of high-quality material from every other course you take going forward. Many thanks for creating this course.
Mudi Lukman
That was a great course to follow, thank you for your efforts.
Hamza Dabaghi
Great hands learning with TDD.I enjoyed it!
Ercument Guven
A very comprehensive introduction to testing spring applications at different levels of the test pyramid. Would recommend the course.
David Smiles
The depth and completeness of the content truly stands out. Exceptional content with comprehensive coverage and rich examples about JUnit5, Mockito and Spring Boot Testing.
Xavier Escudero
this course really worth the time. I feel now really more professional and confident when It comes as a Java and Spring Boot developer
Francisco Thiago
Thanks Philip!, a great course I enjoyed very much.
As I was thinking for future courses if you have time and need some ideas, I'd probably think about an in-depth testcontainers course, with all the twisting details when we use in CICD platforms, cache context and testcontainers,etc,.
Greetings.
Victor
Everything about testing and more covered in this course. Amazing!!
Ercument Guven
Great Course. I am now fully equipped to test my Spring Boot Applications !
Walter Mangra
As a Java developer I have used Mockito on a regular basis and was well aware of some of the content covered. But I must say your course was able to fill some of the missing gaps in my Mockito know how. Thanks...
Walter Mangra
One of the best courses I've had.
Practical real-life examples with a very clear explanation.
Thanks Philip!
Zayed Alabbad
Great course and content. The best I know!
Xavier Escudero
Nice course about testing in Java
Awesome and the best resource to reach the next level in Java development
Thiago
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.
Your Path Towards More Confidence & Productivity
Getting Started
Keeping the Course Content Up-to-Date
Changelog
Spring Boot 3 Migration
Setup for Java Development
Infrastructure Setup With Docker Compose
Application Architecture
Maven Dependencies
Flyway Migration Scripts
Application Configuration
AWS SDK Overrides
Introduction to the Backend Code
Keycloak Configuration Walkthrough
Application Walkthrough
Anatomy of the dependency
Managing library versions
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 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
Introduction to Hamcrest
Introduction to AssertJ
Introduction to JSONAssert
Introduction to JsonPath
Spring Boot Starter Test Conference Talk
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
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
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
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
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
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
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
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
New Spring Cloud AWS Sliced Test Context Annotation
Recap on How to Create a Sliced Spring Context for Testing
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
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
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
Inserting Reviews During the Web Test
Verifying the Outcome of the Test
Refactoring the Test to Page Objects
Recap on Writing Web Tests
Defining Your Own Test Strategy
Naming Conventions for Your Tests
Maven Surefire and Failsafe Plugin Configuration
Visualizing Test Results Within a CI Server
Introduction to Context Caching
Context Caching in Action
Making the Most Of Spring's Context Caching
Further Best Practices for Context Caching
Working With Time
Mocking Static Method Calls
Using GitHub Actions for Your Project
Thank You for Completing the Masterclass
Detailed Module Overview
Discover what we're discussing in the eight modules of the Testing Spring Boot Applications Masterclass.
What this Masterclass Is All About
This Masterclass is ...
The Masterclass is not ...
The Masterclass in Numbers
8
Modules
130+
Course Lessons
10h+
On-Demand Video Content
Sneak Peek of the 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.
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.
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.
Testimonials from Exisiting Course Students
Pricing
ONLINE COURSE EDITION
Advanced testing online course with real-world examples.
189€
Single-User License
30% Discount Promotion (Base Price: 269€)
Best suited for: Self-paced learners with existing testing knowledge.
Most Common Choice in 2024
BUNDLE EDITION
Online Course, eBook and access to the Slack community for Q&A.
287€
Single-User License
30% Discount Promotion (Base Price: 412€)
Best suited for: Developers with the need for additional accountability.
Plus: Time-Limited Add-Ons
COACHING EDITION
Bundle edition plus private 1:1 coaching sessions with the course instructor.
897€
Single-User License
30% Discount Promotion (Base Price: 1280€)
Best suited for: Developers with the need for extra coaching.
FYI: You'll find the final discounted price at the bottom of the following checkout page.
Maximizing Your Company's Annual Training Budget: Many organizations allocate a specific annual budget for employee training. Should you, your manager, or the procurement department require additional information or have any queries, please feel free to contact us at [email protected].
Find more pre-sales questions & answers in the FAQ.
Bonus
Time-Limited Offer: Free Testing Resources
If you decide to enrol for the Testing Spring Boot Applications Masterclass Bundle or Coaching Edition, you'll get three (3!) additional testing-related resources on top for free.
This makes it the perfect testing bundle to kickstart your testing success.
TDD with Spring Boot Done Right Online Course
With TDD with Spring Boot Done Right, you'll learn how to effectively use test-driven development for your Spring Boot application to boost your productivity and confidence.
- No Fluff Examples to learn TDD (No Calculator/Hello World Examples)
- Beyond The Basics of Using TDD
- Real-World Examples, Going Beyond Trivial Unit Tests
- Productivity Boost When Applied Correctly
This online course is sold individually for 99€.
Hands-On Mocking with Mockito Online Course
Learn the ins-and-outs of the most popular mocking framework for Java applications build a solid foundation for your testing success.
- Covering basic & advanced features of Mockito
- Price: 39€
- Course length: 27 course lessons
- More information
30 Testing Tools and Libraries Every Java Developer Must Know eBook
Get a full overview of the Java testing ecosystem: test runner, assertion libraries, mocking frameworks, performance testing etc.
- Enrich your testing toolbox as a Java developer
- Price: 29€
- Currently 20/30 tools & libraries are covered
- More information
100% Satisfaction Guarantee for 60-Days
You are not satisfied with the content of the Masterclass? No problem!
Contact us ([email protected]) within 60 days after you got access to the Masterclass and we'll send you a refund.
No questions asked.
The only exception to this rule: If you've booked the coaching edition and already jumped on a call with us, we can only refund the price of the online course.
Don’t Wait! Look at What Past Students Have to Say About This Course
Michal Kupisiński
Professional IT Trainer - GitHub
Testimonial as a comment on the last course video
Philip, thank you very much for this course. It’s really great and full of valuable knowledge, examples, tips and good practices. It was a pleasure to learn from your experience.
Your course is very comprehensive and there’s a need to spend a lot of time to complete it but it’s worth every minute. To be exact I believe that after those many hours I saved weeks or months of self-learning.
Anton Ždanov
Full Stack Developer - LinkedIn
Testimonial via email
For me testing a Spring application seemed like a challenge involving digging through numerous blog posts, documentation for JUnit, Mockito, and Spring Testing Reference which provide valuable information but are spread out and don't necessarily show the best practices.
After watching the Testing Spring Boot Applications Masterclass course I feel more confident in writing different types of tests for my apps. The course, videos, and the GitHub repository were of invaluable use to me demonstrating various testing mechanics the Spring ecosystem provides, and I will keep referencing the course materials in the future.
P.S. The application that is tested in the course is quite complex and covers a lot of real-world testing challenges one might encounter, which I found immensely useful for seeing the bigger picture.
Enrich Your CV With the Certificate of Completion
Share the certificate of completion on your LinkedIn profile, download it as a PDF or share it on social media.
New to Testing Spring Boot Applications?
Frequently Asked Questions
As I recommend to code in parallel, I assume it takes you about 10 hours in total to work through this Masterclass and get the most of it.
Yes, we offer a 60-days money-back guarantee for both the eBook and the online course.
If you've booked the coaching edition and already jumped on a call with me, the money-back guarantee expires.
As every course student's skill level and preferred learning type is different, I want to offer several starting points to master Testing Spring Boot Applications.
In a nutshell:
Online Course Edition: Comprehensive online course with concise and short (5-15 minutes) video lessons. If you prefer a visual and (or) auditory learning style, this should be your edition of choice.
Bundle Edition: Adding a text/plain version of the Masterclass and access to the private Slack workspace to the mix (on top of the online course). This is the recommended edition for self-pace learning .
Coaching Edition: On top of the bundle edition, you'll get four hours of private coaching. You can use this time to get feedback on your current test strategy, get help for a particular test setup, or even pair program your tests with the course instructor.
Please not that all perks and benefits are included from a lower tier. So if you purchase the Coaching Edition, you'll get all benefits of the Bundle Edition which itself includes all perks of the Online Course Edition.
:greencheck:
Just drop me a message whether you want to upgrade to the Bundle or Coaching edition and I'll create a personalized coupon code for you.
You are a Java developer, work with the Spring framework and want to write tests with joy?
Then it definitely is!
I won't explain what Spring and Spring Boot is all about as there are quite good resources for this available. I assume you have basic knowledge with Spring Boot and Java.
I'm constantly updating all library version and try to be up-to-date. The source code (including the pom.xml) is publicly available on GitHub.
Yes, just send me and email and attach a confirmation (e.g. a picture of your student identity card or a certificate of enrollment for this year) and I'll send you a personalized coupon code.
If you already have an account for my online courses then you can reuse this account. Otherwise create your course account here (no payment info required, just email).
Yes, for sure!
If you are part of a team and want to use this course together with your co-workers, drop me a message and I'll offer you a reduced price per active user.
Definitely yes!
If you are convinced about the Masterclass and want to earn money while recommending it to your audience, you can join as an affiliate.
You'll earn 30% commission for each sale that was made with your link (30 days cookie period).
Yes, indeed.
Simply subscribe to the newsletter and I'll send you four lessons from four different modules.
The Mission Behind This Masterclass
I strongly believe this online course can have a big impact on the overall quality of the applications we write and use. Everybody is benefiting from fewer bugs, fewer outages, and more confidence when pushing changes to production.
Software is indispensable in our daily life. Let's make it robust, safe, and predictable!
Having interviewed many developers throughout the last years, I can see that basic testing techniques are something that almost every junior developer lacks. University does not prepare you for this. Having such skills also uplifts your chances of getting a job.
Once you complete the Masterclass, you'll become better at testing, and enrich your engineering skills. Furthermore, your coworkers' skills will also benefit once you apply the learned techniques to your projects. Win-win!
Let's spread the news that testing can be fun and is an essential skill for every engineer who takes their work seriously.
Your instructor,
Philip