# Thursday, May 27, 2004

Jim Newkirk got his 'day in the sun' to speak about Test Driven Development and the tool out in public promoting Test Driven Development and the tools support he's been involved with using Microsoft Visual Studio Team System.

He started out with a quick audience poll of how many people had heard of Test Driven Development (around 80%) and how many were actually using it (about 30%). So a clear victory for marketing over behaviour change there!

The Two Tenets of Test Driven Development:

  • Never write a single line of code unless you have a failing unit test.  The goal is to take requirements and express them as test
  • Eliminate duplication

How to do TDD
Jim starts by blocking out 4 - 8 hour sessions of development. He spends 15 - 20 minutes at the start of each session thinking about what he is going to do and brainstorming a list of unit tests.

A key part is not to get hung up on completeness, you can always add more later. The purpose of the tests is to describe completion requirements.

The flow of a TDD session: Red, Green, Refactor
The process is:

  • Start by writing a test for a new capability
  • Compile
  • Fix any compile errors
  • Run the test and see it fail
  • Write the code to make the test pass
  • Refactor as needed (clean up any duplication)

The purpose is about how to use the functionality, not how to implement it! The process allows you to build confidence through having a set of tests that pass.

The most successful way to do test is to do it before the development. If you start it first then you need to think about how to test.

Features in Visual Studio Team Systems
Jim used a stack example to demonstrate the process of TDD as well as the support in Visual Stuido Team systems. The first test looked as follows:

[TestClass]
Public class StackFixture
{
   [TestMethod]
   Public void IsEmpty()
   {
      Stack stack = new Stack();
      Assert.IsTrue(stack.IsEmpty);
   }
}

So, the same approach as NUnit, just with new names!

One cool feature was writing a class name followed by a method name that didn't exist yet. After compiling, Jim used a 'smart tag' to choose to create the method stub inside the target class. It wrote this stub and had a 'NotImplementedException' inside it. This is functionality similar to Eclipse and is good to see.

posted on Thursday, May 27, 2004 11:37:54 PM (GMT Daylight Time, UTC+01:00)  #   
Related posts:
Office Server 2007: Can it help me write less code?
Server-side Excel: changing the face of financial apps?
Ray Ozzie: Services Disruption and the need for 'Client Server Service Synergy'
DDD3: Deadline for speaker submissions extended until Monday
DDD III on Sat 3 June: Call for Speakers!
I can see clearly now: NUnitAddin and NCoverBrowser
Tracked by:
"Slots" (Slots) [Trackback]
"phentermine" (phentermine) [Trackback]
"cialis use" (cialis use) [Trackback]
"tramadol" (tramadol) [Trackback]
"buy phentermine no prescription" (buy phentermine no prescription) [Trackback]
"phentermine no prescription" (phentermine no prescription) [Trackback]
"cheap phentermine" (cheap phentermine) [Trackback]
"phentermine diet pills" (phentermine diet pills) [Trackback]
"phentermine without prescription" (phentermine without prescription) [Trackback]
"buy phentermine" (buy phentermine) [Trackback]
"phentermine" (phentermine) [Trackback]
"phentermine 37.5 mg" (phentermine 37.5 mg) [Trackback]
"cheap phentermine" (cheap phentermine) [Trackback]
"generic adipex" (generic adipex) [Trackback]
"discount cialis" (discount cialis) [Trackback]
"viagra" (viagra) [Trackback]
"buy cialis" (buy cialis) [Trackback]
"fioricet" (fioricet) [Trackback]
"discount fioricet" (discount fioricet) [Trackback]
"buy cheap fioricet" (buy cheap fioricet) [Trackback]
"buy fioricet" (buy fioricet) [Trackback]
"sesso gratis" (sesso gratis) [Trackback]
"buy tramadol online cod" (buy tramadol online cod) [Trackback]
"cheap fioricet" (cheap fioricet) [Trackback]
"foto sesso" (foto sesso) [Trackback]
"phentermine diet pills" (phentermine diet pills) [Trackback]
"tramadol" (tramadol) [Trackback]
"phentermine" (phentermine) [Trackback]
"tramadol hcl" (tramadol hcl) [Trackback]
"tramadol hcl" (tramadol hcl) [Trackback]
"cialis" (cialis) [Trackback]
"buy phentermine" (buy phentermine) [Trackback]
"buy fioricet" (buy fioricet) [Trackback]
"phentermine without prescription" (phentermine without prescription) [Trackback]
"phentermine without a prescription" (phentermine without a prescription) [Trackback]
"fioricet" (fioricet) [Trackback]
"fioricet without prescription" (fioricet without prescription) [Trackback]
"fioricet prescription online" (fioricet prescription online) [Trackback]
"buy phentermine online" (buy phentermine online) [Trackback]
"cheap phentermine free shipping" (cheap phentermine free shipping) [Trackback]
"without prescription phentermine" (without prescription phentermine) [Trackback]
"Homeowner Insurance" (Homeowner Insurance) [Trackback]
"888 pacific poker online gambling" (888 pacific poker online gambling) [Trackback]
"Black Jack" (Black Jack) [Trackback]
"Homeowners Insurance" (Homeowners Insurance) [Trackback]
"fisioterapia alluce valgo-25" (fisioterapia alluce valgo-25) [Trackback]
"sposo" (sposo) [Trackback]
"mercedes bens diesel cars rebuilding -3" (mercedes bens diesel cars rebuilding ... [Trackback]
"1970-ford torino" (1970-ford torino ) [Trackback]
"Internet Roulette" (Internet Roulette) [Trackback]
"barium+ferrite pvd filetype pdf" (barium+ferrite pvd filetype pdf ) [Trackback]
"Online Roulette" (Online Roulette) [Trackback]
"Homeowner Insurance" (Homeowner Insurance) [Trackback]
"max lesbians. hot lesbian girls" (max lesbians. hot lesbian girls) [Trackback]