The Artima Developer Community
Sponsored Link

Agile Buzz Forum
The Point of TDD

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Keith Ray

Posts: 658
Nickname: keithray
Registered: May, 2003

Keith Ray is multi-platform software developer and Team Leader
The Point of TDD Posted: Feb 18, 2004 9:28 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Keith Ray.
Original Post: The Point of TDD
Feed Title: MemoRanda
Feed URL: http://homepage.mac.com/1/homepage404ErrorPage.html
Feed Description: Keith Ray's notes to be remembered on agile software development, project management, oo programming, and other topics.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Keith Ray
Latest Posts From MemoRanda

Advertisement

Tim Bacon wrote:

I would much rather aim for 100% test-driven development than aim for 100% test coverage. It seems odd to want to use coverage tools to determine after-the-fact that the development process isn't working as intended, rather than to work constantly with development teams at the source of the problem. High path and branch coverage is a byproduct of the effective use of TDD, not the aim of it.

Scott Hanselman commented:

But I fear he's missing the point.  If I'm only testing 1% of my code paths, 100% of the time, what am I accomplishing? Squat.

As my boss has said, adding a non-intrusive code coverage tool to an already successful unit-testing strategy can absolutely find gaps in coverage that staring at the screen just won't find.

But juxtaposing 100% TDD with a 100% coverage goal doesn't make sense.  They are complimentary, parallel even, but not opposing goals.

My reply: By aiming for 100% TDD, one can get 100% statement-coverage and branch-coverage as a side-effect. It's not that coverage isn't valued, but that getting coverage via TDD is easier than trying to get coverage by after-the-fact unit testing. (And nowhere did Tim Bacon say that he was only aiming for 1% of the code being written by TDD. Read what he wrote!)

TDD's rule is "write no line of code without a test to force its existence." So that pretty much guarantees 100% statement-level coverage. The rule also applies to "if" statements, etc., so you don't write an "if" statement unless you have a test to force it to exist - pretty much guaranteeing 100% branch-coverage.

The key misunderstanding is that Test Driven Development isn't primarily a testing technique, it's a development technique - a way to drive the design of working code that happens to leave a suite of "programmer tests" as a highly valuable side-effect. We use the term "programmer tests" to try to avoid misunderstandings based on the term "unit test". XP has "customer tests" / acceptance tests (driven by the customer) as a whole second level of tests -- but the point is to get "just enough" tests to insure high quality -- which is a LOT more testing than most software projects get.

I think there used to be a page in Ward's Wiki with a title like TheUnitInUnitTestIsntTheUnitYouAreThinkingOf but it appears to be gone now. See http://c2.com/cgi/wiki?search=unit and http://c2.com/cgi/wiki?search=test for whole lot of info about XP, TDD, and testing.

Read: The Point of TDD

Topic: A Defense of Marriage Amendment? Previous Topic   Next Topic Topic: A Really Small Smalltalk

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use