A beginners guide to Test Driven Development
Upcoming SlideShare
Loading in...5

A beginners guide to Test Driven Development






Total Views
Views on SlideShare
Embed Views



3 Embeds 89

http://nareshak.wordpress.com 84
https://www.linkedin.com 3
http://www.linkedin.com 2



Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

A beginners guide to Test Driven Development A beginners guide to Test Driven Development Presentation Transcript

  • A Beginners Guide to Test Driven Development Developing Sustainable Software….Naresha K.,Software CraftsmanTwitter: @naresha_k
  • DisclaimerThe opinions or views expressedin this presentation are solely ofthe speaker and do not necessarilyrepresent the views of myemployer.
  • 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 500 150 100 50 20 2Analysis Design Coding Integration Acceptance Production
  • 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/crystaljingsr/3914729343/
  • 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 • 14th weeks weeks weeks weeks week
  • 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
  • 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 – Early, Small & Often – But involves cost
  • 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 => more S
  • 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 executable description of what code does• Regression suite
  • 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 pass tests
  • 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 Internal Quality Feedback Unit tests End-End testing White Box Black Box
  • http://www.flickr.com/photos/winning-information/2325865367/
  • http://www.flickr.com/photos/winning-information/2325865367/