Post on 19-Jan-2017
transcript
A Beginners Guide to
Test Driven Development
Developing Sustainable Software….
Naresha K.,
Software Craftsman
Twitter: @naresha_k
Disclaimer
The opinions or views expressed
in this presentation are solely of
the speaker and do not necessarily
represent the views of my
employer.
You are Here
http://www.flickr.com/photos/oldben/2322196242/
The Significance
Never
in the field of software development
have so many owed
so much to
so few lines of code
Cost of Change
2
20
50
100150
500
Analysis Design Coding Integration Acceptance Production
Cost
Cost
We are only afraid of…
http://www.flickr.com/photos/spursfan_ace/2328879637/http://www.flickr.com/photos/crystaljingsr/3914729343/
Planning – The Waterfall way
http://www.flickr.com/photos/vizzzual-dot-com/2655969483/
The waterfall way
Analysis
• 2 weeks
Design
• 3 weeks
Code
• 4 weeks
Test
• 4 weeks
Release
• 14th
week
The fall of waterfall
Analysis
• 2 weeks
• 2 weeks
Design
• 3 weeks
• 4 weeks
Code
• 4 weeks
• 5 weeks
Test
• 4 weeks
• 2 weeks
Release
• 14th
week
• 14th
week
Testing can only indicate the quality
http://www.flickr.com/photos/24560044@N08/5726488676/
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 Assumption
http://www.flickr.com/photos/9465588@N05/3302103347/
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/
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
Feedback from tests
Unit tests End-End testing
Am
ount
of
Fee
dbac
k
Internal Quality Feedback
External Quality Feedback
White Box Black Box
http://www.flickr.com/photos/winning-information/2325865367/
http://www.flickr.com/photos/winning-information/2325865367/