Quantcast
Channel: Testing
Viewing all articles
Browse latest Browse all 9

Four Essential Skills to Master for Test-Driven Development

$
0
0

Test-Driven Development (TDD) is a fundamental programming skill in short supply today.  TDD is a powerful design technique that improves the quality and reliability of software as unit tests are automated and run more frequently.  One of the key concepts behind TDD is that the software become self-checking.  As more people touch the code, they feel comfortable to make changes because if they introduce an error, ideally the software will tell them they made a mistake.  This helps the code become more stable over time.

This becomes increasingly important as software begins to take over many functions of our day-to-day lives.  Recently, the Tesla autopilot feature experienced a catastrophic failure.  As it turns out, the software failed to recognize a truck as it turned in front of an oncoming Tesla and failed to apply the breaks.  The driver was killed.  When I heard this story, I wondered if Tesla had a unit test for that case?  If not, did they update their unit tests after this failure to include this test case?

crosscountryskiTeaching TDD is a lot like learning how to ski cross-country.  The fundamentals (Red-Green-Refactor) are easy to learn and put into practice in a classroom setting for two, three or four days.  After a few hours, novice cross-country skiers (or TDDers) will be gliding across the countryside enjoying themselves and having fun with their friends.

downhill-skiingEventually, some people will graduate to downhill skiing, which (as they will quickly learn) is nothing like cross-country skiing.  One, the skis are wider and shorter.  Two, skiers go a lot faster.  Three, you have learn how to turn.  For some people, knowing how to ski cross-country is disorienting and puts them at a disadvantage when downhill skiing.  The same can be true of people applying what they learned about TDD in a classroom setting on production code.  It is only a matter of time before the skier falls down, hits a tree or smashes into someone else.

So why is this transition so hard?  In her keynote speech at Agile Portugal, Emily Bache identified the four design skills one has to master to use TDD effectively with production code.

  1. Driving development with test cases: this is probably the hardest step
  2. Designing test cases:
  3. Refactoring safely: refactoring is
  4. Designing clean code: clean code is any code that is easy to write, read and maintain.  Learning how to do this takes time.  Thankfully, Robert C Martin (“Uncle Bob”) wrote an entire book on this topic and this article explains what clean code looks like.

The post Four Essential Skills to Master for Test-Driven Development appeared first on .


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images