Testing With Nullables
“Nullables” are a novel technique for isolating production code from external systems and state. Although they also have production uses, they’re particularly valuable for creating fast, reliable tests. This page connects to you resources for using Nullables in your code.
Read this in-depth article for everything you need to know about Nullables and their related patterns. It’s a long article, but don’t be intimidated by its size. It’s broken up into bite-sized pieces with lots of code examples.
If you’d prefer to start with something smaller, check out A Light Introduction to Nullables.
For a brief comparison of Nullables and mocks, see How Are Nullables Different From Mocks?
The following video was created to announce my “Testing Without Mocks” training course, but it also does a great job of explaining what Nullables are and why they’re valuable. It’s nice and short: less than five minutes.
To be notified about future “Testing Without Mocks” training courses, join the mailing list here (requires Google login).
For private training, contact me directly.
In this weekly livestream series, which ran from November 2022 to April 2023, I pair up with Ted M. Young, aka jitterted. We look at Nullables and A-Frame Architecture as an alternative to Mocks, Spies, and Hexagonal Architecture in a Java/Spring Boot codebase. Each episode combines a healthy dose of architecture and design discussion with practical, hands-on coding.
Ted M. Young and I continue our weekly pairing sessions as we build an AI-powered role-playing game using React, Spring Boot, and Nullables. And, of course, plenty of discussion about design, architecture, and effective programming practices! You can catch this series live every Monday or watch the back episodes.
The series emphasizes real-world TDD, with a strong focus on “hard” problems such as networking and logging. Many of the episodes involve Nullables and other “Testing Without Mocks” patterns. If you’ve learned the basics of TDD and want to see how it works in the real world, this series is the perfect next step.
This is what Nullable-based tests look like:
Find more examples here:
Testing Without Mocks: A Pattern Language. This in-depth article is chock-full of examples and other details.