Why TDD is good for testers

A while back during a presentation on unit tests a member of the audience asked me a question I hope never to answer ever again – “So these unit tests you’re talking about, are they written by developers?”

The reason I don’t particularly care for that question is that developers think that unit tests (and tests in general) are a part of the tester’s work (hence the name). Just because TDD (Test Driven Development) has the word test in it doesn’t mean it is a form of testing, in fact is a development methodology which means that it should be practiced by developers to create code.

It’s not that unit tests cannot be written by testers, in fact I’ve worked on a project where some of the unit tests were written by the QA team with very limited success – because the QA team didn’t know the code I wrote as good as it was difficult to produce good unit tests.

So why should testers care about unit tests? Some think that tester’s role will become obsolete if we’ll write enough automatic tests, both unit tests and integration/acceptance tests – I say that’s just wrong. Even if an application can be 100% tested using automatic tests there is no way in hell that the developer that wrote the code will be able to come up with all of the scenarios in which his code can fail. Us developer are too attached to our code, and testing our application for flaws is almost impossible emotionally.

 

So the tester’s job is safe. But should he care about what the crazy dev guys are up to? absolutely!

Because when a developer take the time to unit test his code it means that the tester receives a better product to test.

I cringe when I remember what a crappy code I used to ship to QA – some of it was so low quality that it didn’t even run. Nowadays this doesn’t happen, I do get a bug reported from time to time but it’s usually not a “stupid bug” because I made sure that my code worked before it left my machine.

Unit tests proved that my code can run and do most of what it suppose to do so that the tester can concentrate in finding bugs instead of checking that that my code passes basic sanity.

 

So if you’re a tester get the dev team to TDD so you’ll be able to do real work instead babysit code the developer was too lazy to run even once…

 

Related Link:

2 thoughts on “Why TDD is good for testers

  1. Actually. I have understood lately that it's not even a test. It's a design and if you don't do additional testing you won't have done any real testing at all. You might end up with a regression test for free though.

  2. You're right – It is a test, but not in the traditional way. And although TDD is a design methodology, it also guarantees that the code was checked before it was tossed over to the testing team. Using unit testing during development makes sure that the code was run at least once and prevents DOA (dead on arrival) code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.