Get The Book
The Saff Squeeze
June 10, 2026From time to time, we encounter bugs in the software systems that we work on. That’s part of the life as a software developer. Often, we don’t know the root cause of the defect. So, in order to uncover what is going on we typically start a debugging session.
However, when we take a step back and think about defects from a higher level, we can conclude that every bug in the system actually corresponds to a missing test in the code base. An alternative to this default behavior is using the Saff Squeeze technique. The goal of this technique is to find that missing test.
The Saff Squeeze is a way to find bugs, starting with a high-level end-to-end test and working towards a small, unambiguous test that clearly demonstrates the defect.
“ Inline parts of a failing test until the reason for the failure becomes obvious.— J.B. Rainsberger
The technique works by following these steps:
- Start with a failing high-level test that reproduces the defect.
- Inline the method(s) called on the system under test. (Breaking encapsulation is acceptable at this stage)
- Add assertions at the beginning of the test, gradually moving towards the failure while verifying all assumptions.
- Tidy up the test code and remove all irrelevant parts.
- Repeat until the test is minimal and the defect becomes obvious.
Some advantages of using this technique:
- Leaves behind clear, reusable unit tests.
- Turn defects into focused insights.
- Encourages debugging through testing rather than relying on breakpoints or stepping through code.
- Allows a steady pace from failure to fix.
Just give it a try. It’s a useful way to find defects while adding missing tests to your codebase.
References:
If you and your team want to learn more about how to write maintainable unit tests and get the most out of TDD practices, make sure to have look at my trainings and workshops or check out the books section. Feel free to reach out at info@principal-it.be.
Jan Van Ryswyck
Thank you for visiting my blog. I’m a professional software developer since Y2K. A blogger since Y2K+5. Author of Writing Maintainable Unit Tests. Teaching and coaching XP / Lean practices. Speaker at tech conferences. Curator of the Awesome Talks list. Thinking and learning about all kinds of technologies since forever.
Comments
Get The Book
Writing Maintainable
Unit Tests
Watch The Videos
Latest articles
-
The Saff Squeeze
June 10, 2026
-
Fixing vs Preventing Defects
March 12, 2026
-
Tales Of TDD: One Test Double To Rule Them All
March 5, 2026
-
Perspectives On Software Quality
February 3, 2026
-
The Five Underplayed Premises Of TDD
August 8, 2025
Tags
- .NET
- ALT.NET
- ASP.NET
- Agile
- Announcement
- Architecture
- Behavior-Driven Development
- C++
- CQRS
- Clojure
- CoffeeScript
- Community
- Concurrent Programming
- Conferences
- Continuous Integration
- Core Skills
- CouchDB
- Database
- Design Patterns
- Domain-Driven Design
- Event Sourcing
- F#
- Fluent Interfaces
- Functional Programming
- Hacking
- Humor
- Java
- JavaScript
- Linux
- Microsoft
- NHibernate
- NoSQL
- Node.js
- Object-Relational Mapping
- Open Source
- Reading
- Ruby
- Software Design
- Software Quality
- SourceControl
- Test-Driven Development
- Testing
- Tools
- Visual Studio
- Web
- Windows
Disclaimer
The opinions expressed on this blog are my own personal opinions. These do NOT represent anyone else’s view on the world in any way whatsoever.
About
Thank you for visiting my website. I’m a professional software developer since Y2K. A blogger since Y2K+5. Author of Writing Maintainable Unit Tests. Teaching and coaching XP / Lean practices. Speaker at tech conferences. Curator of the Awesome Talks list. Thinking and learning about all kinds of technologies since forever.
Latest articles
The Saff Squeeze
Fixing vs Preventing Defects
Tales Of TDD: One Test Double To Rule Them All
Perspectives On Software Quality
Contact information
(+32) 496 38 00 82
info@principal-it.be