Introduction to tdd
1 / 11

Introduction to TDD - PowerPoint PPT Presentation

  • Uploaded on

Introduction to TDD. Sean Chambers April 2 nd 2008. About Sean. Senior Developer at Flagler County Schools for 5 years Lead Developer/Partner of Owner Hybrid Software, Educational Software

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' Introduction to TDD' - teige

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Introduction to tdd

Introduction to TDD

Sean Chambers

April 2nd 2008

About sean
About Sean

  • Senior Developer at Flagler County Schools for 5 years

  • Lead Developer/Partner of

  • Owner Hybrid Software, Educational Software

  • Contributor to various open source projects (Castle Project, Nhibernate, NUnit, NBehave)

  • Practicing TDD for 2 years

  • Domain Driven Design for 1 year

  • Blog:

  • Twitter: schambers

Why use tdd
Why use TDD?

  • Software requirements are constantly changing

  • Changes to the codebase can introduce bugs that you may not even know exist

  • Test Driven Development aims to have a constant suite of tests to verify that changes do not introduce any new bugs and/or change behavior


  • TDD is a technique for developing software that focuses on writing tests to drive functionality of the software being developed. It provides a test bench that provides constant feedback about your codebase. Therefore, impacts to the code from changes can be viewed system wide all the time

  • An overview of testing software

  • unit tests/state testing

  • integration testing (CruiseControl/TeamCity/

The tdd mantra
The TDD Mantra

  • The TDD Mantra is “Red-Green-Refactor”

  • RED

    • Write a test for a piece of functionality so that it is failing

  • Green

    • Write JUST ENOUGH code to make the test pass. (KISS)

  • Refactor

    • Reorganize code to enforce DRY/SRP etc..

    • By far the most difficult step

What tools do i need
What tools do I need?

  • The best part is: they are all open source!

  • Test Runner

    • Nunit

    • MbUnit

  • Test Runners within VS

    • TestDriven.Net

    • ReSharper Test Runner (used in this presentation)

What does tdd do for you
What does TDD do for you?

  • A form of documentation with unit tests that can convey what the system does.

  • Loose Coupling of Modules

  • Enforces YAGNI and KISS in the form of very small iterative steps

  • Rarely need to invoke a debugger, some even say they no longer need one! This dramatically speeds up development

  • Although more code is actually written with TDD, implementation time is actually shorter when you get up to speed with TDD

Tdd video store sample
TDD Video Store Sample

  • Sample application with TDD for a video store. With the following User Stories

    • A Video has a Title, Description and a UPC

    • A Rental has a checkout date and a return date

    • A Rental is associated with a Video and a Customer

    • A Customer can checkout a video from the Video Store which creates a rental for the customer

    • A Manager can view overdue Rentals for a Customer

    • A Manager can view all Rentals for a Customer

Other types of tests
Other types of Tests

  • Bug fixing tests

  • Database tests with NHibernate

  • MVC Controller tests with MonoRail/ASP.NetMVC

What else to tdd
What else to TDD?

  • ORM IoC/Dependency Injection

  • Stubs and Mocks

  • Different Project Structures to promote new techniques

  • Code Coverage tells you how much of your code has tests for it, can be misleading however

  • Continuous Integration with CruiseControl.NET/TeamCity to run tests after every checkin

  • Some projects created using TDD

Additional resources
Additional Resources

  • [email protected]