Test Driven DevelopmentTest Driven Development
Part 1
Gamal ShaabanGamal Shaaban
International Centers
Orange Labs Cairo
Mobile Applications & Software Development
Orange presentation
Questions?
3 Orange restricted
Fact?
4 Orange restricted
Session-1Session-1
4
• Why TDD
• Quality In Time and Cost
• Cost To Change
• Steps To TDD
• Red Green Refactor Cycle
• Write Red Test
• Write Green Code
• Do Refactoring Code
5 Orange restricted
Why TDD: Quality TriangleWhy TDD: Quality Triangle
• TDD benefits
o Clean Design
o Fast Feedback
o Concrete Evidence That Your
Software Works
o Write Better Code
o Reduced Gold-Plating
o Regression Test Suite
5
6 Orange restricted
Cost To Change ChartCost To Change Chart
http://www.agilemodeling.com/essays/costOfChange.htm
6
7 Orange restricted
Steps To TDDSteps To TDD
7
8 Orange restricted
Red Green RefactorRed Green Refactor
CycleCycle
9 Orange restricted
Write fail tests, make test passes, refactor your code, repeat
this action
9
10 Orange restricted
How To Do TDDHow To Do TDD
1. Analyze the requirements and write the list of
tasks or features
2. Pick a task or feature
3. Brainstorm a list of tests for the task or feature
4. Review the tests list and pick a test
5. Write the test case
6. Run the test case and see it fails to compile
7. Write only enough code that the test case
compiles
8. Run the test and see running the code fails
9. Write only enough code to just pass the test
10.Refactor the production code and eliminate
duplication
11.Repeat
10
11 Orange restricted
12 Orange restricted
13 Orange restricted
14 Orange restricted
15 Orange restricted
Orange presentation
Questions?
thanks

Test Driven Development Part 1

Editor's Notes

  • #4 “TDD Intro” Is all code guilty until proven innocent??? can we find out?
  • #5 why tdd: 30 min Steps to TDD: 90 min Workshop for doing red green test: 120 min
  • #9 write Red test. write greed code that passes the test. refactor your code.
  • #13 Make a workshop for writing a test first then code example write red test. write greet code do the cycle again. do fibonacci example.