TDD (JSAG)Presented By : Harinder Singh Bedi6 July 2011
AgendaWhat is TDD ?
Steps to start
Refactoring
TDD terminology
Benefits
JUnit
Mocktio
Continuous IntegrationTest Driven Development (TDD) or Test First Development is a Software Development technique and one of the key factors of Extreme Programming Methodology.Test Driven Development
Development ApproachesAd hoc development
Writing pseudo code first
Model Driven Development (MDD)
Test Driven Development (TDD)What is TDD ?TDD = Test First Development + Refactoring
How Does TDD HelpEnsures that your design is clean by focusing on creation of operations that are callable and testable
Shortens the programming feedback loop
Provides detailed specification through tests
Provides concrete evidence that your software works
Supports evolutionary development.TDD says ..When we have a new feature to implement, we initially often think, ok how should I implement this ?But TDD says don't do it! "In TDD, the greater emphasis is on the usage rather than implementation"
Steps to start TDDAnalyze the requirements and write the list of tasks or featuresPick a task or featureBrainstorm a list of tests for the task or featureReview the tests list and pick a testWrite the test caseRun the test case and see it fails to compileWrite only enough code that the test case compilesRun the test and see running the code failsWrite only enough code to just pass the testRefactor the production code and eliminate duplicationRepeat
When a bug is found ..First create a test case to reveal the bugModify the production code so that the failed test passes Finally run all the tests and make sure your bug is fixed and covered.
Refactoring is one of the most important parts of TDD, which means you need to refine the code design as you add new tests.Refactoring should be done consistently as you increment the software, adding tests and production code.Refactoring

TDD - Agile