Test-Driven Development What is Test-Driven Development? Origins of TDD Clean code with no defects TDD in conjunction with Agile
Why TDD ? Much less time needed to debug Code proven to meet requirements Quick feedback at each step Rhythm of Success
Mechanics of TDD Start with a failing test Write the simplest code needed to pass the test Remove duplication ( Refactor ) Repeat as needed to meet requirements RED     GREEN   REFACTOR
What should be tested? Valid inputs Invalid inputs Errors, exceptions, and events Boundary conditions Everything that could possibly break!
TDD as a Design Technique Design only what you need to make the test pass Requirements drive the design of code Design evolves with time
Fixing Bugs – TDD Style Go after the most painful defect Write a test to expose it Write code needed to fix it Refactor Measure the results
TDD Benefits for Business Shorter development cycles Near zero defects Tests become an asset Tests are documentation Competitive advantage!
Get some training Start with a small visible project Shoot for 100% test coverage Don’t expect to be perfect Expect to improve dramatically in time Measure the results Getting started with TDD
Test-Driven Development TDD Demonstration

Test Driven Development by Sameer Arora

  • 1.
    Test-Driven Development Whatis Test-Driven Development? Origins of TDD Clean code with no defects TDD in conjunction with Agile
  • 2.
    Why TDD ?Much less time needed to debug Code proven to meet requirements Quick feedback at each step Rhythm of Success
  • 3.
    Mechanics of TDDStart with a failing test Write the simplest code needed to pass the test Remove duplication ( Refactor ) Repeat as needed to meet requirements RED GREEN REFACTOR
  • 4.
    What should betested? Valid inputs Invalid inputs Errors, exceptions, and events Boundary conditions Everything that could possibly break!
  • 5.
    TDD as aDesign Technique Design only what you need to make the test pass Requirements drive the design of code Design evolves with time
  • 6.
    Fixing Bugs –TDD Style Go after the most painful defect Write a test to expose it Write code needed to fix it Refactor Measure the results
  • 7.
    TDD Benefits forBusiness Shorter development cycles Near zero defects Tests become an asset Tests are documentation Competitive advantage!
  • 8.
    Get some trainingStart with a small visible project Shoot for 100% test coverage Don’t expect to be perfect Expect to improve dramatically in time Measure the results Getting started with TDD
  • 9.