0
A Beginners Guide to           Test Driven Development           Developing Sustainable Software….Naresha K.,Software Craf...
DisclaimerThe opinions or views expressedin this presentation are solely ofthe speaker and do not necessarilyrepresent the...
You are Herehttp://www.flickr.com/photos/oldben/2322196242/
The Roadmap You are  here         Threat Driven DevelopmentDestination     Test Driven Development
The SignificanceNeverin the field of software developmenthave so many owedso much toso few lines of code
The Problemshttp://www.flickr.com/photos/donnagrayson/195244498/
Cost of Change                             Cost                              Cost                                         ...
Time To Markethttp://www.flickr.com/photos/cobalt/5800169708/
Sustainable Softwarehttp://www.flickr.com/photos/sillygwailo/146872543/
We are only afraid of…http://www.flickr.com/photos/spursfan_ace/2328879637/       http://www.flickr.com/photos/crystaljing...
We are only afraid of…http://www.flickr.com/photos/spursfan_ace/2328879637/
Planning – The Waterfall way  http://www.flickr.com/photos/vizzzual-dot-com/2655969483/
The waterfall wayAnalysis    Design      Code        Test        Release  • 2         • 3         • 4         • 4         ...
The fall of waterfallAnalysis    Design      Code        Test        Release  • 2         • 3         • 4         • 4     ...
Testing can only indicate the quality     http://www.flickr.com/photos/24560044@N08/5726488676/
But Feedback is Important
When to receive feedback?• Closest to the incident• Frequently• You get more time to act upon
Test Early Approach• Test as and when you complete small chunk of  code (say a function – is it small?)• Integrate  – Earl...
Nature of Business Environment    http://www.flickr.com/photos/oldben/2301828397/
Mistaken Assumptionhttp://www.flickr.com/photos/9465588@N05/3302103347/
The SolutionEmbrace Change
Automated Testing• Mitigates  – Integration testing cost  – Regression testing cost
Benefits• S - Savings through early integration• C - Cost of automating tests• ROI = S / C• (Small + Often) integration =>...
Still Problems !!http://www.flickr.com/photos/mosmancouncil/3361174929/
Waste• Unused Code• Lack of modularity
The Ultimate Solution• Write test code before production code
How Writing Tests Help?• Clarifies the acceptance criteria• Encourages to write loosely coupled  components• Adds executab...
How Running Tests Help?• Detects errors (early)• Lets us know when we have done enough• Avoid unnecessary features
Test Driven Cycle                1. Write              failing Tests                          2. Write code3. Refactor    ...
TDD – Rule #1No code will be written without a failing test
TDD – Rule #2No more tests will be written   Than sufficient to fail
TDD – Rule #3No more code will be written   than sufficient to pass        failing tests
Demo
Feedback from tests                                       External Quality FeedbackAmount of Feedback                     ...
http://www.flickr.com/photos/winning-information/2325865367/
http://www.flickr.com/photos/winning-information/2325865367/
Upcoming SlideShare
Loading in...5
×

A beginners guide to Test Driven Development

1,245

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,245
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "A beginners guide to Test Driven Development"

  1. 1. A Beginners Guide to Test Driven Development Developing Sustainable Software….Naresha K.,Software CraftsmanTwitter: @naresha_k
  2. 2. DisclaimerThe opinions or views expressedin this presentation are solely ofthe speaker and do not necessarilyrepresent the views of myemployer.
  3. 3. You are Herehttp://www.flickr.com/photos/oldben/2322196242/
  4. 4. The Roadmap You are here Threat Driven DevelopmentDestination Test Driven Development
  5. 5. The SignificanceNeverin the field of software developmenthave so many owedso much toso few lines of code
  6. 6. The Problemshttp://www.flickr.com/photos/donnagrayson/195244498/
  7. 7. Cost of Change Cost Cost 500 150 100 50 20 2Analysis Design Coding Integration Acceptance Production
  8. 8. Time To Markethttp://www.flickr.com/photos/cobalt/5800169708/
  9. 9. Sustainable Softwarehttp://www.flickr.com/photos/sillygwailo/146872543/
  10. 10. We are only afraid of…http://www.flickr.com/photos/spursfan_ace/2328879637/ http://www.flickr.com/photos/crystaljingsr/3914729343/
  11. 11. We are only afraid of…http://www.flickr.com/photos/spursfan_ace/2328879637/
  12. 12. Planning – The Waterfall way http://www.flickr.com/photos/vizzzual-dot-com/2655969483/
  13. 13. The waterfall wayAnalysis Design Code Test Release • 2 • 3 • 4 • 4 • 14th weeks weeks weeks weeks week
  14. 14. The fall of waterfallAnalysis Design Code Test Release • 2 • 3 • 4 • 4 • 14th weeks weeks weeks weeks week • 2 • 4 • 5 • 2 • 14th weeks weeks weeks weeks week
  15. 15. Testing can only indicate the quality http://www.flickr.com/photos/24560044@N08/5726488676/
  16. 16. But Feedback is Important
  17. 17. When to receive feedback?• Closest to the incident• Frequently• You get more time to act upon
  18. 18. Test Early Approach• Test as and when you complete small chunk of code (say a function – is it small?)• Integrate – Early, Small & Often – But involves cost
  19. 19. Nature of Business Environment http://www.flickr.com/photos/oldben/2301828397/
  20. 20. Mistaken Assumptionhttp://www.flickr.com/photos/9465588@N05/3302103347/
  21. 21. The SolutionEmbrace Change
  22. 22. Automated Testing• Mitigates – Integration testing cost – Regression testing cost
  23. 23. Benefits• S - Savings through early integration• C - Cost of automating tests• ROI = S / C• (Small + Often) integration => more S
  24. 24. Still Problems !!http://www.flickr.com/photos/mosmancouncil/3361174929/
  25. 25. Waste• Unused Code• Lack of modularity
  26. 26. The Ultimate Solution• Write test code before production code
  27. 27. How Writing Tests Help?• Clarifies the acceptance criteria• Encourages to write loosely coupled components• Adds executable description of what code does• Regression suite
  28. 28. How Running Tests Help?• Detects errors (early)• Lets us know when we have done enough• Avoid unnecessary features
  29. 29. Test Driven Cycle 1. Write failing Tests 2. Write code3. Refactor pass tests
  30. 30. TDD – Rule #1No code will be written without a failing test
  31. 31. TDD – Rule #2No more tests will be written Than sufficient to fail
  32. 32. TDD – Rule #3No more code will be written than sufficient to pass failing tests
  33. 33. Demo
  34. 34. Feedback from tests External Quality FeedbackAmount of Feedback Internal Quality Feedback Unit tests End-End testing White Box Black Box
  35. 35. http://www.flickr.com/photos/winning-information/2325865367/
  36. 36. http://www.flickr.com/photos/winning-information/2325865367/
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×