Nullable Infrastructure: A Drop-In Replacement for Mocks
James Shore

If you're familiar with unit testing, you're probably also familiar with the brittleness and excessive boilerplate that often results from overuse of mock objects and other test doubles. They're a great tool, sure, but they also make tests hard to read and code hard to refactor. Luckily, there's another way to do it: nullable infrastructure. Nullable infrastructure is part of James Shore's "Testing Without Mocks" pattern language. It's a drop-in replacement for normal test doubles that allows you to move from isolated interaction-based tests to sociable state-based tests. The end result is tests that are fast, reliable, and low-maintenance. In this hands-on workshop, we'll use a simple Node.js microservice client to demonstrate how nullable infrastructure works. We'll start with traditional mock-based tests and modify them to use nullable infrastructure instead. Then we'll explore how to create your own nullable infrastructure from scratch. Along the way, you'll learn the tradeoffs involved and come to your own conclusions about when to use mocks and when to use nullable infrastructure. This is a highly technical workshop intended for programmers. Be sure to read the following prerequisites and come prepared to code! **Prerequisites and Advance Setup** This is a hands-on coding workshop. You'll be programming in JavaScript and Node.js and running commands from the command-line. Prior experience with unit tests and mock objects is highly recommended. Familiarity with JavaScript, Node.js, Mocha, Chai, command-line basics, and microservice basics is also recommended. Please bring a laptop prepared in advance with the following: 1. Install Node.js 2. Install Git 3. Install your favorite JavaScript code editor 4. Clone the example repository: `git clone` (Note: this repo will not be available until the conference begins.) 5. Read the README and run the build

Date & Time
Wednesday, July 20, 2022, 2:00 PM - 5:00 PM
Location Name
Lincoln CDE
Download Session PDF
Session Type
3 Hour Workshop
Learning Level
Accelerating Products, Sponsored by LTI Canvas
Software Engineering | Technical |