Is there a difference between TDD and Test First Development (or Test First Programming)?

Thomas Owens picture Thomas Owens · Dec 2, 2008 · Viewed 20.1k times · Source

Both ideas sound very similar to me, but there might be subtle differences or the exact same thing, explained in different ways. What is the relationship between TDD and Test First Development/Programming?

Answer

Jon Skeet picture Jon Skeet · Dec 2, 2008

There's a difference in terms of what the driving factor is.

Do you have a vague idea of what the class (or system - this can happen at different scales, of course) should look like, then think up tests which give it the actual shape? That's TDD.

Do you know exactly what the public API of the class should be, and just write the tests before the implementation? That's test-first development.

My style tends to be a mixture of the two. Sometimes it's obvious what the API should be before writing any tests - in other cases testability really drives the design.

To put it another way, TDD starts with "What questions do I want to ask?" whereas non-TDD (whether test first or not) starts with "What answer do I want to give?"