Unit Testing Error Handling and Exceptions

One of the things that unit tests are best for is checking error conditions. While we want wider coverage of full happy flows, error conditions are sometimes hard to simulate in a big system, and unit tests excel at minimal setup to… Continue Reading…

InfoQ Interview on Test First Approaches

My interview on InfoQ about “Test-first approaches with TDD and BDD” is live. Go check it out. And come to the Agile Practitioners conference to experience these things yourselves!

Legacy Code To Testable Code #12: Instance Constructors

Other awesome posts in the series: So we talked about static constructors and how to go around them. How about instance constructors? Are they innocent or guilty of the same crimes as their static brothers? I think Java got the… Continue Reading…

Legacy Code to Testable Code #11: MOAR Static Constructors

The other posts in the series: Where we last left off, we discussed how to dismantle the static constructor (or initializer) booby traps. And I promised you an example. I’ll do that in C#, but the operations apply to any… Continue Reading…

Legacy Code to Testable Code #10: Getting Rid of Static Constructors

Here is the rest of the gang: This time we’re going to tackle the most problematic issue in testing object-oriented languages. Obviously because constructors only exist in those, but also, because even power tools have problems handling them. But we’ll start… Continue Reading…

Testing Strategy Analysis – An Example

Each stage of implementation is hard in its own way. When we start out with a new effort or process, we think of it as: Sure, it will be hard in the beginning, but it’s going to become easier as… Continue Reading…

TDD: Speed and Flow

Kevlin Henney asked once: Why do cars have brakes? Imagine if cars didn’t have brakes, how fast would you go? You’ll be driving really slow to not hit anything. But by giving the capability to slow down, brakes actually give… Continue Reading…

TDD: It’s Not That Simple

TDD is pretty simple right? Obey the red-green-refactor step-by-step and you’re on your way to glorious, non-legacy code. It’s really easy to explain. The rules are easy to follow. Why then so few people actually do it, and when they… Continue Reading…

How Can I Write A Test If The Code Is Not There?

Introducing TDD is a lot more psychological than you think. When we start introducing TDD we need to think about how people new will react. For example, the first question that people ask is: How am I going to write… Continue Reading…

Legacy Code to Testable Code #8: Convert If-Else’s to Guard Blocks

I know, you want to check out the rest of the series. Here are the links: Code simplification is one of the best things we can do for ourselves. If we understand the code, not only will we write simpler… Continue Reading…

Copyright Gil Zilberfeld, 2025