Making Good Software

A blog by Alberto G (Alberto Gutierrez)

Written by Alberto Gutierrez

November 21st, 2009 at 12:01 pm

TDD is not about testing!!!

with 12 comments

Lots of people confuse “test first methodologies” with TDD, it is very common to listen comments like “TDD is just about writing your tests first”, which are completely wrong, these kind of affirmations are not describing TDD at all, they are talking about test first development.

The main reason for confusing TDD and test first development is its own name: “test driven development”. If someone that doesn’t know about TDD would had to guess based on the name what TDD is, would probably guess that is just a test first methodology. But is not!

TDD as invented by Kent Beck, (who also invented Xtreme programming and Junit), goes beyond that. In the core of TDD there is a process to follow, which makes it already different from a simple test first approach.

Test-driven_development

Image source: Wikipedia

This is also known as red (make your test fail), green (make it pass) and refactor . Where this may be seen as a small difference from a test first approach, if combined with some other agile engineering practices and development philosophies, makes TDD quite different from any other test first approach, it actually switches the focus from testing to design.

TDD is a design practice, is more related with emergent design than with testing. TDD looses much of its potential if it is not combined with other agile engineering practices, or agile philosophies as YAGNI and KISS, in TDD having a large set of tests is a nice side effect, not just its purpose.

To know if you are doing TDD the right way, look at your code, TDD code should look simple and lean, TDD also usually generates more testing code than production code, and you should feel that it helps you to design your code.

So, next time you say you are doing TDD make sure you don’t mean that you are doing test first development.

12 Responses to 'TDD is not about testing!!!'

Subscribe to comments with RSS or TrackBack to 'TDD is not about testing!!!'.

  1. [...] This post was mentioned on Twitter by Erwan ALLIAUME, Morten Jokumsen. Morten Jokumsen said: Liked "TDD is not about testing!!!" http://ff.im/-bOyW4 [...]

  2. Devmentia

    22 Nov 09 at 4:43 am

  3. [...] Test Driven Development Posted in Acceptance testing by testing in London on the November 22, 2009 From Making Good Software [...]

  4. Spot on about TDD being a design approach rather than writing your tests first. But I don’t agree that TDD is not useful if you are not pair programming. Even if you are coding all by yourself, TDD is the right way to go about it. TDD turns you into becoming the first consumer of your own code, thereby making you think about the APIs that you write. This helps you clean up the APIs.

    Aneesh

    22 Nov 09 at 9:14 pm

  5. >>TDD is pointless if it is not combined with other agile engineering practices, as pair programming, or agile philosophies as YAGNI and KISS

    This is not true. TDD!=agile. It produces very good results even without that stuff.

    Bubak

    23 Nov 09 at 2:12 am

  6. Hi Bubak! That’s a good observation, maybe I was too extremist with my article, TDD is not pointless without other agile techniques, but certainly helps to use them.

    Alberto Gutierrez

    23 Nov 09 at 2:21 am

  7. Hi Aneesh, you are right, pair programming is not necessary to perform TDD, I obviously was too extrimist on my paragraph >>TDD is pointless if it is not combined with other agile engineering practices, as pair programming, or agile philosophies as YAGNI and KISS, I am going to correct it now, thanks for your observation

    Alberto Gutierrez

    23 Nov 09 at 2:26 am

  8. Hi Alberto, your post is very interesting. I’ve translated it in french TDD ne concerne pas que le test !!!
    Regards, Fabrice

    Fabrice Aimetti

    28 Nov 09 at 1:21 am

  9. [...] Making Good Software, leí una vez un post muy interesante titulado “TDD is not about testing!!!” que me llamó mucho la atención al principio. Mucha gente piensa que escribir los tests primero es [...]

  10. Hi Alberto, good point.
    Actually, I think that (1) TDD should not be seen in an agile context at all because (2) TDD is essentially a general programming technique which produces some desirable side effects (like e.g. ‘good’ code, repeatable tests). But the bottom line is: TDD is programming. I wrote a quite detailed blog post about this, which is called TDD is not about testing, it’s about how we develop software (sic)…

    Thomas Weller

    1 Feb 10 at 3:30 am

  11. Hi Thomas! I’ve just read your post, quite interesting! Thank for you comment!!

    Alberto Gutierrez

    1 Feb 10 at 6:51 am

  12. [...] is lately a lot of hype around engineering practices as TDD, Refactoring, keeping things simple (KISS)… and while they are great, it is important to remember [...]

Leave a Reply