Unit Testing - what does "unit" mean there? Is it a public method? A class? 2 classes? No. It's a "unit of behavior" says Kent Beck, the author of JUnit and inventor of Unit Testing. It's the thinnest slice you can isolate from a full feature, ideally end-to-end. On the other hand, it's easier to write fine-grained tests covering a single method or a class, but they won't provide you the same degree of safety as larger end-to-end automated tests. That's why we should aim to to cover as much code possible with isolated, repeatable and reasonably fast tests, while also keeping them simple and maintainable. But that's hard. It's one of the most difficult task for any developer, no matter how experienced.

After discussing unit testing for hundreds of hours in dozens of companies, I found that the biggest challenges for most teams is to identify the risks in their code, and then to master the testing tools to cover that code with simple, effective tests. Tests that really help you catch bugs and save you time, while not impeding future refactoring. During this course you will learn techniques to bring more of your application under tests by making best use of the Spring Framework's testing support.

This is the recording of a 4-hours live webinar that took place in September 2020 with 26 live participants. The content is extremely dense, mixed with explanations of how the Spring Framework works internally.

Agenda

During this training you will learn:

Every single technique we cover can run on your CI Jenkins pipeline!

What to expect?

During the training we write automated tests for 3 simplified examples of production code, for each one trying out and comparing various testing strategies. Below you can find a diagram summarizing all topics covered in detail.

Each working alternative was carefully committed to a git that you will get access to. Even if it's 90% code, the discussion insists on principles, best practices and pitfalls of the solutions we implement, and acknowledges that you can google up additional details afterwards about the deeper topics we touch upon (Docker, WireMock). After watching the video, I will insist you ask me any kind of question you have related to what we covered.

After following this course, you'll take away at least a dozen of key practical techniques that you can immediately apply to your day-to-day work. Expect an intense but entertaining experience, as usual!

Target Audience

Java developers with prior contact with Spring Framework, or otherwise extremely eager to learn it. Basic knowledge of a mocking framework (like Mockito) is also useful.

Technical Requirements

To be able to run the code locally, your machine should have a Java 11+ SDK installed, Docker, and access to Maven Central. If you want to directly replicate my actions, download and install IntelliJ Community Edition, as I occasionally used some of its specific features.

After purchase, besides video recording and slides, you will be able to download the final code zipped together with the git history, allowing you to browse through the commits at your own pace.

Further Reading

Here are some resources you could use to learn more about the techniques we use in the training:

P.S.: The content is distilled from my 2-days (16-hours) Unit Testing training. If you are interested in a private dedicated session for your company, please find here my entire curricula and contact details.

Below is a master overview of all that we cover in the course. The blue arrow denote the tests we wrote and the red rectangles are the techniques we used:

Course Curriculum

Resources
▤Slides LOCKED
▤Final Code, with Git History LOCKED
▶Part 1 - Mock Bean & Fake Beans (45:55) LOCKED
▶Part 2 - Testing Repositories + Cucumber + Dockerized DB (56:03) LOCKED
▶Part 3 - More Relational, WireMock, Mocking Time (46:41) LOCKED
▶Part 4 - Mock MVC, Rest Template, Dockerized End-to-end Tests (61:59) LOCKED
Victor Rentea

Trainer: Victor Rentea

Victor Rentea is a Java Champion, Associate Professor and Technical Trainer writing code for over two decades in many languages.

He is training developers since 2012, having developed an extensive curriculum that covers most of the software engineering best practices and typical Java-stack development. You can read dozens of recommendations from the developers he trained on LinkedIn and on victorrentea.ro.

Victor is best known for the energy of his talks, many ranked among the best at their conference. You can expect a similar style here, explaining complex concepts in simple, easy-to-remember terms.

Get Access

€35
3.5 hours of video · slides · final code with git history
VAT of your country is added at checkout.

Frequently Asked Questions

How long do I have access to the course?

How does lifetime access sound? After enrolling, you have unlimited access to this course for as long as you like, across any and all devices you own.

Can I get an invoice for my company?

Payments are handled by Onelink, Stripe's reseller, which emails you the receipt. For a company invoice, contact Onelink starting from that receipt email.

I bought this course on Teachable. Do I pay again?

No. Every Teachable purchase was carried over: get your access link with the email you used there.