Test-first software development helps us build testable behaviors and support refactoring.

Write the Test First

Green Bar Guilty Pleasures

I’ve already written about the importance of getting to the red bar and the value of a failing test but once we get the red bar we want to move on and get to the green bar as soon as possible. In fact, turning the red bar green, which is really what TDD is all …

Read More
Write the Test First

Celebrate the Red Bar

Many important things happen getting to the red bar. In a test first approach where we write our test before we write our production code, we define the method signature before we build its implementation. That means we are thinking about how to call a method before it is written. This reinforces designing to interfaces …

Read More
Write the Test First

When Are Tests Most Valuable?

Don’t we get the most value from our tests when they fail? We may wear our seatbelt every time we get in the car but when we get into an accident and use our seatbelt is when we are most grateful for having it. This is also true with tests. It is not until a test breaks …

Read More
Write the Test First

In TDD Failures Can Be Good

Rarely is failure a good thing in life but in test driven development a failing test can be a very good thing. Many TDD developers dread the “red bar” but it is really worth celebrating and here’s why. Developers are often under the mistaken impression that TDD is about getting to the “green bar”. This …

Read More
Write the Test First

“That’s Not TDD”

A few months ago I was visiting a client who was having a lot of problems using TDD. “It takes over half an hour to run our unit tests,” he said. “You are not doing TDD,” I said. “In order for tests to be valuable, all of them must run fast—within a few seconds, or …

Read More