Your SlideShare is downloading. ×
A beginners guide to Test Driven Development
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

A beginners guide to Test Driven Development

1,149
views

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,149
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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