Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

RE: Expand / Collapse
Posted Thursday, February 9, 2006 12:23 AM


Group: General Forum Members
Last Login: Thursday, July 19, 2012 7:19 AM
Points: 23, Visits: 36



There is a cardinal mistake in the artcle about the TDD flow.

You wrote:

In TDD, we follow the steps below.

  • Create the test case for testing each tiny bit of functionality.
  • Run this test ( it will fail the first time as there is no code for this functionality.)
  • Write only the code to pass the test cases.
  • Run the test case again
  • If the test case fails refractor the code to pass the test case

However, in TDD you *never* refactor to make a test pass! You should get the test to pass in the simplest way (sometimes even by "cheating" with a hardcoded result), and then refactor only while all test are passing. This makes sure you'r refactorings are always just "refactoring" (i.e. just changing the structure of the code without changing behaviour), while assuring that you *always* have code that works (even if it's still being refactored).

Nevertheless I was happy to see this article on SQLServerCentral, and especially glad to hear about the TSQL perspective. (I've been doing TSQL TDD manually for several months now, without any framework.. it's definitely hard but worthwhile. )

 - Avi



Post #256947
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse