SlideShare une entreprise Scribd logo
1  sur  60
Télécharger pour lire hors ligne
TESTING AND TDD 
John McCaffrey 
@ J_McCaffrey 
Wednesday, October 29, 14
AGENDA 
• Poll: What are your current testing practices? 
•What is TDD? 
•Where does it fit in the Agile landscape 
• TDD basics 
• Pros/Cons/Controversy 
• Demo/Q&A 
Wednesday, October 29, 14
ME 
• Started Unit testing in Java 
• TDD Javascript & Ruby 
• Love Testing and TDD 
Wednesday, October 29, 14
YOU 
•What are you doing already? 
•What are you hoping to learn? 
Wednesday, October 29, 14
TDD DEFINED 
Wednesday, October 29, 14
TDD DEFINED 
• Software Development practice 
• Focus on explicit expectations from tests 
• Characterized by red/green/refactor 
Wednesday, October 29, 14
RED/GREEN/REFACTOR 
Wednesday, October 29, 14
TDD BENEFITS 
• Correct behavior 
• Rapid feedback 
• Simpler, easier to understand 
• Fully covered by tests 
• Living documentation 
• Confidence 
Wednesday, October 29, 14
TDD == GTD? 
• Collect 
• Process 
• Organize 
• Review 
• Do it 
Wednesday, October 29, 14
• not just testing in general 
• more of a design practice 
with test benefits 
• TDD is not a silver-bullet! 
Wednesday, October 29, 14
WHAT WE WILL COVER 
•Where Testing and TDD fit in Agile 
• General Agile Testing practices 
• TDD Practice 
• Pros/Cons/Controversy 
• Demo/Q&A 
Wednesday, October 29, 14
TDD RESOURCES 
• Blogs, Books, Workshops 
• Confreaks.com 
• pluralsight.com 
Wednesday, October 29, 14
WHY IS TESTING SO CRITICAL? 
Wednesday, October 29, 14
DOES OUR CODE... 
• function correctly? 
• handle expected edge cases and exceptions? 
• allow for new features and change? 
• make sense to new team members? 
Wednesday, October 29, 14
MO’ PROBLEMS 
• Code changes create new bugs 
• Fear of changing anything leads to worse code 
• Estimates are higher, changes take longer 
• Bugs, Bugs, Bugs, regression, Bugs, Bugs 
• Time between build to feedback is too long 
Wednesday, October 29, 14
WITH TESTS 
• Code change is safer 
• Component design is clearer 
• Feedback is quicker 
• Safety and freedom to make the code better 
Wednesday, October 29, 14
TESTS ARE FOR EVERYONE 
• Managers and Business team 
• QA Team 
• Support 
• dev ops 
• Customers 
Wednesday, October 29, 14
TESTING TYPES 
• Unit 
• Functional 
• Integration/system testing 
• User acceptance 
• Manual testing 
Wednesday, October 29, 14
DIFFERENT TYPES OF TESTS 
Wednesday, October 29, 14
TDD APPLIED 
• You can use TDD and Test-First with all types of testing 
• TDD helps you focus on your specific task 
• TDD may be challenging for some types of testing 
Wednesday, October 29, 14
TESTING & TDD 
IN THE 
AGILE LANDSCAPE 
Wednesday, October 29, 14
FEEDBACK IS KEY 
Wednesday, October 29, 14
AGILE: 
FEEDBACK AT EVERY LEVEL 
Wednesday, October 29, 14
SHORTEST CYCLE 
Wednesday, October 29, 14
XP PRACTICES 
• Planning Game 
• On-site Customer 
• Small Releases 
• Simple design 
• Customer Testing 
• Metaphor 
• Sustainable pace (40hr) 
• Common Standards 
• Collective Ownership 
• Unit Testing 
• Refactoring 
• Continuous Integration 
• Pair Programming 
Wednesday, October 29, 14
XP PRACTICES 
• Planning Game 
• On-site Customer 
• Small Releases 
• Simple design 
• Customer Testing 
• Metaphor 
• Sustainable pace (40hr) 
• Common Standards 
• Collective Ownership 
• Unit Testing 
• Refactoring 
• Continuous Integration 
• Pair Programming 
Wednesday, October 29, 14
TDD FEEDBACK CYCLE 
• Code is correct 
• Design is workable 
• Intention is clear 
• Dependencies and collaborators are minimal 
• It does what the Developer intended.... 
Wednesday, October 29, 14
IF YOU ONLY GET ONE THING 
OUT OF THIS... 
Wednesday, October 29, 14
FEEDBACK IS KEY 
Wednesday, October 29, 14
IF YOU ONLY GET ONE THING OUT 
OF THIS... 
• Define acceptance test criteria as team, as part of the story 
definition 
• write out the test steps 
• plan to automate them 
• update with any test cases that are discovered 
Wednesday, October 29, 14
TDD WON’T FIX BAD 
REQUIREMENTS!! 
Wednesday, October 29, 14
THE PAYOFF 
Wednesday, October 29, 14
THE AWESOME 
• high coverage 
• fast 
• informative 
• not brittle 
• visible to the team 
Wednesday, October 29, 14
TDD IN PRACTICE 
Wednesday, October 29, 14
TERMINOLOGY 
• Unit tests 
• Setup/Fixture 
• Assertion 
• Coverage 
• Design 
• Interface/contract 
• Mock/Stub 
• DRY 
• YAGNI 
• Automated tests 
• Continuous integration 
• Continuous deployment 
Wednesday, October 29, 14
TDD WORKFLOW 
• write the test, watch it fail 
• write “just enough” code to make it pass 
• rinse/repeat, improving the tests and code as you go 
Wednesday, October 29, 14
SIMPLE DESIGN 
• Passes all the tests 
• Minimal Duplication 
• Maximizes clarity 
• Fewest number of classes or methods 
Wednesday, October 29, 14
SIMPLE DESIGN 
• Low Coupling 
• High Cohesion 
• High Encapsulation 
• SOLID 
Wednesday, October 29, 14
TDD WORKFLOW 
• New code 
• Legacy 
• Bugs 
Wednesday, October 29, 14
NEW CODE 
Wednesday, October 29, 14
STORY SAMPLE 
• As a Standard User I need to see my list of 
outstanding orders, so I can review and 
complete them in priority order 
Wednesday, October 29, 14
STORY SAMPLE 
• As a Standard User I need to see my list of 
outstanding orders, so I can review and 
complete them in priority order 
Wednesday, October 29, 14
STORY SAMPLE 
• As a Customer I need to calculate the tip for 
my bill, so I can save time and include a 
reasonable amount 
Wednesday, October 29, 14
TEST CODE 
Wednesday, October 29, 14
TEST 
Wednesday, October 29, 14
CODE 
Wednesday, October 29, 14
LEGACY 
• first, do no harm 
• get sufficient coverage in place 
• confirm existing functionality is correct 
• review tests cases with team 
Wednesday, October 29, 14
TEST FIRST, 
REFACTOR LATER 
I’M SERIOUS!! 
Wednesday, October 29, 14
CODE SAMPLE 
Wednesday, October 29, 14
BUGS 
• write a test to confirm the bug 
• change the code to fix the bug 
• the test should confirm the fix 
Wednesday, October 29, 14
PROS/CONS 
Wednesday, October 29, 14
PROS 
• Focus 
• Confidence 
• Rapid Feedback 
• Clear intention 
• Executable documentation 
Wednesday, October 29, 14
CONS 
• TDD is HARD!! 
• Refactoring is an uncertain art 
• Some parts are hard to test first 
• False sense of security 
• Focus more on the tests than the system! 
Wednesday, October 29, 14
ANTI-PATT3RNS 
• huge setup, reused unnecessarily 
• too much going on in one test 
• only testing happy-path, not exceptions 
• too much boiler-plate, basic tests 
• over-mocking: “tests pass, but production is broken” 
• not doing the ‘refactor’ part of Red/Green/Refactor 
Wednesday, October 29, 14
CONTROVERSY 
Wednesday, October 29, 14
Wednesday, October 29, 14
CONTROVERSY 
• Used to love and promote TDD 
• Dogmatic TDD is not helpful 
• Focusing exclusively on speed and low-coupling 
• Shaming others for not following “TDD or Die!” 
Wednesday, October 29, 14
SUMMARY 
• Tests are worth the investment 
• Everyone on the team should care about them 
• TDD is a great way to improve your code and tests 
• Find an approach that works best for your team 
Wednesday, October 29, 14
RESOURCES 
• TDD is Dead - David Heinemeier-Hansson 
• R.I.P. TDD - Kent Beck 
• TDD “straw-men and rhetoric” - Gary Bernhardt 
• Failures of “Intro to TDD” - Justin Searls 
• Pragmatics of TDD - ‘Uncle’ Bob Martin 
• When to Mock - ‘Uncle’ Bob Martin 
• TDD Failed to become mainstream 
• TDD a Love-Story - Nell Shamrell 
Wednesday, October 29, 14
LET’S HAVE SOME 
QUESTIONS! 
John McCaffrey 
@ J_McCaffrey 
Wednesday, October 29, 14

Contenu connexe

En vedette

Developing for Wearables with Xamarin
Developing for Wearables with XamarinDeveloping for Wearables with Xamarin
Developing for Wearables with XamarinGert Cominotto
 
Mudanças no scrum guide (julho/2016)
Mudanças no scrum guide (julho/2016)Mudanças no scrum guide (julho/2016)
Mudanças no scrum guide (julho/2016)Augusto Rückert
 
WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)Brian Richards
 
The #1 Skill for Game Designers and How to Practice It
The #1 Skill for Game Designers and How to Practice ItThe #1 Skill for Game Designers and How to Practice It
The #1 Skill for Game Designers and How to Practice ItRoberto Dillon
 
TranSMART: How open source software revolutionizes drug discovery through cro...
TranSMART: How open source software revolutionizes drug discovery through cro...TranSMART: How open source software revolutionizes drug discovery through cro...
TranSMART: How open source software revolutionizes drug discovery through cro...keesvb
 
01 - Citizenship vs. Patriotism
01 - Citizenship vs. Patriotism01 - Citizenship vs. Patriotism
01 - Citizenship vs. PatriotismPaul English
 
Renderings of the Martin Luther King Jr. Memorial Library Renovation
Renderings of the Martin Luther King Jr. Memorial Library RenovationRenderings of the Martin Luther King Jr. Memorial Library Renovation
Renderings of the Martin Luther King Jr. Memorial Library RenovationZach Brown, MBA, CSSR
 
CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...
CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...
CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...Sean Ekins
 
Marketing de conteúdo e inteligência coletiva - Gramado
Marketing de conteúdo e inteligência coletiva - GramadoMarketing de conteúdo e inteligência coletiva - Gramado
Marketing de conteúdo e inteligência coletiva - GramadoMarcio Okabe
 
Pantone's Color of the Year and How You Can Use It for Business
Pantone's Color of the Year and How You Can Use It for BusinessPantone's Color of the Year and How You Can Use It for Business
Pantone's Color of the Year and How You Can Use It for BusinessSlideGenius, Inc.
 
Certificado de apresentação
Certificado de apresentaçãoCertificado de apresentação
Certificado de apresentaçãoGuilherme Ponce
 
Real timefrauddetectiononbigdata
Real timefrauddetectiononbigdataReal timefrauddetectiononbigdata
Real timefrauddetectiononbigdataPranab Ghosh
 
Digital olympus – Serpstat
Digital olympus – SerpstatDigital olympus – Serpstat
Digital olympus – SerpstatIgor Gorbenko
 
Juliaのパッケージをつくろう!
Juliaのパッケージをつくろう!Juliaのパッケージをつくろう!
Juliaのパッケージをつくろう!Kenta Sato
 
多世代コミュニティを誘発する社会のデザイン
多世代コミュニティを誘発する社会のデザイン多世代コミュニティを誘発する社会のデザイン
多世代コミュニティを誘発する社会のデザインDementia Friendly Japan Initiative
 

En vedette (20)

Getting started
Getting startedGetting started
Getting started
 
Xbcom 275 week 3 dq 1
Xbcom 275 week 3 dq 1Xbcom 275 week 3 dq 1
Xbcom 275 week 3 dq 1
 
Developing for Wearables with Xamarin
Developing for Wearables with XamarinDeveloping for Wearables with Xamarin
Developing for Wearables with Xamarin
 
Mudanças no scrum guide (julho/2016)
Mudanças no scrum guide (julho/2016)Mudanças no scrum guide (julho/2016)
Mudanças no scrum guide (julho/2016)
 
WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)
 
The #1 Skill for Game Designers and How to Practice It
The #1 Skill for Game Designers and How to Practice ItThe #1 Skill for Game Designers and How to Practice It
The #1 Skill for Game Designers and How to Practice It
 
TranSMART: How open source software revolutionizes drug discovery through cro...
TranSMART: How open source software revolutionizes drug discovery through cro...TranSMART: How open source software revolutionizes drug discovery through cro...
TranSMART: How open source software revolutionizes drug discovery through cro...
 
01 - Citizenship vs. Patriotism
01 - Citizenship vs. Patriotism01 - Citizenship vs. Patriotism
01 - Citizenship vs. Patriotism
 
Renderings of the Martin Luther King Jr. Memorial Library Renovation
Renderings of the Martin Luther King Jr. Memorial Library RenovationRenderings of the Martin Luther King Jr. Memorial Library Renovation
Renderings of the Martin Luther King Jr. Memorial Library Renovation
 
Нетворкинг в бизнесе: связи, которые работают
Нетворкинг в бизнесе: связи, которые работаютНетворкинг в бизнесе: связи, которые работают
Нетворкинг в бизнесе: связи, которые работают
 
Eritema Nodoso
Eritema NodosoEritema Nodoso
Eritema Nodoso
 
CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...
CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...
CDD: Vault, CDD: Vision and CDD: Models software for biologists and chemists ...
 
Marketing de conteúdo e inteligência coletiva - Gramado
Marketing de conteúdo e inteligência coletiva - GramadoMarketing de conteúdo e inteligência coletiva - Gramado
Marketing de conteúdo e inteligência coletiva - Gramado
 
Pantone's Color of the Year and How You Can Use It for Business
Pantone's Color of the Year and How You Can Use It for BusinessPantone's Color of the Year and How You Can Use It for Business
Pantone's Color of the Year and How You Can Use It for Business
 
1
11
1
 
Certificado de apresentação
Certificado de apresentaçãoCertificado de apresentação
Certificado de apresentação
 
Real timefrauddetectiononbigdata
Real timefrauddetectiononbigdataReal timefrauddetectiononbigdata
Real timefrauddetectiononbigdata
 
Digital olympus – Serpstat
Digital olympus – SerpstatDigital olympus – Serpstat
Digital olympus – Serpstat
 
Juliaのパッケージをつくろう!
Juliaのパッケージをつくろう!Juliaのパッケージをつくろう!
Juliaのパッケージをつくろう!
 
多世代コミュニティを誘発する社会のデザイン
多世代コミュニティを誘発する社会のデザイン多世代コミュニティを誘発する社会のデザイン
多世代コミュニティを誘発する社会のデザイン
 

Similaire à A Taste of TDD: The basics of TDD, why it is hard and how to do it better

Principles Before Practices: Transform Your Testing by Understanding Key Conc...
Principles Before Practices: Transform Your Testing by Understanding Key Conc...Principles Before Practices: Transform Your Testing by Understanding Key Conc...
Principles Before Practices: Transform Your Testing by Understanding Key Conc...TechWell
 
UX STRAT USA 2021: Jane Davis, Zoom
UX STRAT USA 2021: Jane Davis, ZoomUX STRAT USA 2021: Jane Davis, Zoom
UX STRAT USA 2021: Jane Davis, ZoomUX STRAT
 
Agile testing experiments
Agile testing experimentsAgile testing experiments
Agile testing experimentsBaiju Joseph
 
My Experiments In Agile Testing in Yahoo.pptx
My Experiments In Agile Testing in Yahoo.pptxMy Experiments In Agile Testing in Yahoo.pptx
My Experiments In Agile Testing in Yahoo.pptxBaiju Joseph
 
TDD - Christchurch APN May 2012
TDD - Christchurch APN May 2012TDD - Christchurch APN May 2012
TDD - Christchurch APN May 2012Alan Christensen
 
User Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your NeedsUser Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your NeedsEffective
 
Effective engineer
Effective engineerEffective engineer
Effective engineerTony Vu
 
Lessons learned the hard way in growing Perdoo
Lessons learned the hard way in growing PerdooLessons learned the hard way in growing Perdoo
Lessons learned the hard way in growing PerdooSaaStock
 
Just In Time Usabilty Testing
Just In Time Usabilty TestingJust In Time Usabilty Testing
Just In Time Usabilty TestingK Skate April
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDDSarah Dutkiewicz
 
Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...
Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...
Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...Claudia Badell
 
Design is a Process, not an Artefact - Trisha Gee (MongoDB)
Design is a Process, not an Artefact - Trisha Gee (MongoDB)Design is a Process, not an Artefact - Trisha Gee (MongoDB)
Design is a Process, not an Artefact - Trisha Gee (MongoDB)jaxLondonConference
 
Becoming a Drupal Technical Project Manager
Becoming a Drupal Technical Project ManagerBecoming a Drupal Technical Project Manager
Becoming a Drupal Technical Project ManagerJohnnie Fox
 

Similaire à A Taste of TDD: The basics of TDD, why it is hard and how to do it better (20)

Principles Before Practices: Transform Your Testing by Understanding Key Conc...
Principles Before Practices: Transform Your Testing by Understanding Key Conc...Principles Before Practices: Transform Your Testing by Understanding Key Conc...
Principles Before Practices: Transform Your Testing by Understanding Key Conc...
 
Intro to TDD
Intro to TDDIntro to TDD
Intro to TDD
 
UX STRAT USA 2021: Jane Davis, Zoom
UX STRAT USA 2021: Jane Davis, ZoomUX STRAT USA 2021: Jane Davis, Zoom
UX STRAT USA 2021: Jane Davis, Zoom
 
Agile testing experiments
Agile testing experimentsAgile testing experiments
Agile testing experiments
 
My Experiments In Agile Testing in Yahoo.pptx
My Experiments In Agile Testing in Yahoo.pptxMy Experiments In Agile Testing in Yahoo.pptx
My Experiments In Agile Testing in Yahoo.pptx
 
Is TDD dead?
Is TDD dead?Is TDD dead?
Is TDD dead?
 
Lean UX
Lean UXLean UX
Lean UX
 
TDD - Christchurch APN May 2012
TDD - Christchurch APN May 2012TDD - Christchurch APN May 2012
TDD - Christchurch APN May 2012
 
User Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your NeedsUser Testing: Adapt to Fit Your Needs
User Testing: Adapt to Fit Your Needs
 
Theory of Constraints
Theory of ConstraintsTheory of Constraints
Theory of Constraints
 
Effective engineer
Effective engineerEffective engineer
Effective engineer
 
Exploratory testing
Exploratory testingExploratory testing
Exploratory testing
 
Lessons learned the hard way in growing Perdoo
Lessons learned the hard way in growing PerdooLessons learned the hard way in growing Perdoo
Lessons learned the hard way in growing Perdoo
 
Just In Time Usabilty Testing
Just In Time Usabilty TestingJust In Time Usabilty Testing
Just In Time Usabilty Testing
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDD
 
Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...
Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...
Webinar at AgileTD Mondays: Mind maps to support exploratory testing: a team ...
 
Design is a Process, not an Artefact - Trisha Gee (MongoDB)
Design is a Process, not an Artefact - Trisha Gee (MongoDB)Design is a Process, not an Artefact - Trisha Gee (MongoDB)
Design is a Process, not an Artefact - Trisha Gee (MongoDB)
 
Exploratory testing
Exploratory testingExploratory testing
Exploratory testing
 
Becoming a Drupal Technical Project Manager
Becoming a Drupal Technical Project ManagerBecoming a Drupal Technical Project Manager
Becoming a Drupal Technical Project Manager
 

Plus de John McCaffrey

Becoming a more Productive Rails Developer
Becoming a more Productive Rails DeveloperBecoming a more Productive Rails Developer
Becoming a more Productive Rails DeveloperJohn McCaffrey
 
LeanStartup:Research is cheaper than development
LeanStartup:Research is cheaper than developmentLeanStartup:Research is cheaper than development
LeanStartup:Research is cheaper than developmentJohn McCaffrey
 
Becoming a more productive Rails Developer
Becoming a more productive Rails DeveloperBecoming a more productive Rails Developer
Becoming a more productive Rails DeveloperJohn McCaffrey
 
Windycityrails page performance
Windycityrails page performanceWindycityrails page performance
Windycityrails page performanceJohn McCaffrey
 
Freelancing and side-projects on Rails
Freelancing and side-projects on RailsFreelancing and side-projects on Rails
Freelancing and side-projects on RailsJohn McCaffrey
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuningJohn McCaffrey
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...John McCaffrey
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuningJohn McCaffrey
 
improving the performance of Rails web Applications
improving the performance of Rails web Applicationsimproving the performance of Rails web Applications
improving the performance of Rails web ApplicationsJohn McCaffrey
 
PDF Generation in Rails with Prawn and Prawn-to: John McCaffrey
PDF Generation in Rails with Prawn and Prawn-to: John McCaffreyPDF Generation in Rails with Prawn and Prawn-to: John McCaffrey
PDF Generation in Rails with Prawn and Prawn-to: John McCaffreyJohn McCaffrey
 

Plus de John McCaffrey (13)

John's Sample
John's SampleJohn's Sample
John's Sample
 
Becoming a more Productive Rails Developer
Becoming a more Productive Rails DeveloperBecoming a more Productive Rails Developer
Becoming a more Productive Rails Developer
 
LeanStartup:Research is cheaper than development
LeanStartup:Research is cheaper than developmentLeanStartup:Research is cheaper than development
LeanStartup:Research is cheaper than development
 
Becoming a more productive Rails Developer
Becoming a more productive Rails DeveloperBecoming a more productive Rails Developer
Becoming a more productive Rails Developer
 
Cloud tools
Cloud toolsCloud tools
Cloud tools
 
Windycityrails page performance
Windycityrails page performanceWindycityrails page performance
Windycityrails page performance
 
Irb Tips and Tricks
Irb Tips and TricksIrb Tips and Tricks
Irb Tips and Tricks
 
Freelancing and side-projects on Rails
Freelancing and side-projects on RailsFreelancing and side-projects on Rails
Freelancing and side-projects on Rails
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
 
improving the performance of Rails web Applications
improving the performance of Rails web Applicationsimproving the performance of Rails web Applications
improving the performance of Rails web Applications
 
PDF Generation in Rails with Prawn and Prawn-to: John McCaffrey
PDF Generation in Rails with Prawn and Prawn-to: John McCaffreyPDF Generation in Rails with Prawn and Prawn-to: John McCaffrey
PDF Generation in Rails with Prawn and Prawn-to: John McCaffrey
 

Dernier

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Dernier (20)

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

A Taste of TDD: The basics of TDD, why it is hard and how to do it better

  • 1. TESTING AND TDD John McCaffrey @ J_McCaffrey Wednesday, October 29, 14
  • 2. AGENDA • Poll: What are your current testing practices? •What is TDD? •Where does it fit in the Agile landscape • TDD basics • Pros/Cons/Controversy • Demo/Q&A Wednesday, October 29, 14
  • 3. ME • Started Unit testing in Java • TDD Javascript & Ruby • Love Testing and TDD Wednesday, October 29, 14
  • 4. YOU •What are you doing already? •What are you hoping to learn? Wednesday, October 29, 14
  • 5. TDD DEFINED Wednesday, October 29, 14
  • 6. TDD DEFINED • Software Development practice • Focus on explicit expectations from tests • Characterized by red/green/refactor Wednesday, October 29, 14
  • 8. TDD BENEFITS • Correct behavior • Rapid feedback • Simpler, easier to understand • Fully covered by tests • Living documentation • Confidence Wednesday, October 29, 14
  • 9. TDD == GTD? • Collect • Process • Organize • Review • Do it Wednesday, October 29, 14
  • 10. • not just testing in general • more of a design practice with test benefits • TDD is not a silver-bullet! Wednesday, October 29, 14
  • 11. WHAT WE WILL COVER •Where Testing and TDD fit in Agile • General Agile Testing practices • TDD Practice • Pros/Cons/Controversy • Demo/Q&A Wednesday, October 29, 14
  • 12. TDD RESOURCES • Blogs, Books, Workshops • Confreaks.com • pluralsight.com Wednesday, October 29, 14
  • 13. WHY IS TESTING SO CRITICAL? Wednesday, October 29, 14
  • 14. DOES OUR CODE... • function correctly? • handle expected edge cases and exceptions? • allow for new features and change? • make sense to new team members? Wednesday, October 29, 14
  • 15. MO’ PROBLEMS • Code changes create new bugs • Fear of changing anything leads to worse code • Estimates are higher, changes take longer • Bugs, Bugs, Bugs, regression, Bugs, Bugs • Time between build to feedback is too long Wednesday, October 29, 14
  • 16. WITH TESTS • Code change is safer • Component design is clearer • Feedback is quicker • Safety and freedom to make the code better Wednesday, October 29, 14
  • 17. TESTS ARE FOR EVERYONE • Managers and Business team • QA Team • Support • dev ops • Customers Wednesday, October 29, 14
  • 18. TESTING TYPES • Unit • Functional • Integration/system testing • User acceptance • Manual testing Wednesday, October 29, 14
  • 19. DIFFERENT TYPES OF TESTS Wednesday, October 29, 14
  • 20. TDD APPLIED • You can use TDD and Test-First with all types of testing • TDD helps you focus on your specific task • TDD may be challenging for some types of testing Wednesday, October 29, 14
  • 21. TESTING & TDD IN THE AGILE LANDSCAPE Wednesday, October 29, 14
  • 22. FEEDBACK IS KEY Wednesday, October 29, 14
  • 23. AGILE: FEEDBACK AT EVERY LEVEL Wednesday, October 29, 14
  • 24. SHORTEST CYCLE Wednesday, October 29, 14
  • 25. XP PRACTICES • Planning Game • On-site Customer • Small Releases • Simple design • Customer Testing • Metaphor • Sustainable pace (40hr) • Common Standards • Collective Ownership • Unit Testing • Refactoring • Continuous Integration • Pair Programming Wednesday, October 29, 14
  • 26. XP PRACTICES • Planning Game • On-site Customer • Small Releases • Simple design • Customer Testing • Metaphor • Sustainable pace (40hr) • Common Standards • Collective Ownership • Unit Testing • Refactoring • Continuous Integration • Pair Programming Wednesday, October 29, 14
  • 27. TDD FEEDBACK CYCLE • Code is correct • Design is workable • Intention is clear • Dependencies and collaborators are minimal • It does what the Developer intended.... Wednesday, October 29, 14
  • 28. IF YOU ONLY GET ONE THING OUT OF THIS... Wednesday, October 29, 14
  • 29. FEEDBACK IS KEY Wednesday, October 29, 14
  • 30. IF YOU ONLY GET ONE THING OUT OF THIS... • Define acceptance test criteria as team, as part of the story definition • write out the test steps • plan to automate them • update with any test cases that are discovered Wednesday, October 29, 14
  • 31. TDD WON’T FIX BAD REQUIREMENTS!! Wednesday, October 29, 14
  • 32. THE PAYOFF Wednesday, October 29, 14
  • 33. THE AWESOME • high coverage • fast • informative • not brittle • visible to the team Wednesday, October 29, 14
  • 34. TDD IN PRACTICE Wednesday, October 29, 14
  • 35. TERMINOLOGY • Unit tests • Setup/Fixture • Assertion • Coverage • Design • Interface/contract • Mock/Stub • DRY • YAGNI • Automated tests • Continuous integration • Continuous deployment Wednesday, October 29, 14
  • 36. TDD WORKFLOW • write the test, watch it fail • write “just enough” code to make it pass • rinse/repeat, improving the tests and code as you go Wednesday, October 29, 14
  • 37. SIMPLE DESIGN • Passes all the tests • Minimal Duplication • Maximizes clarity • Fewest number of classes or methods Wednesday, October 29, 14
  • 38. SIMPLE DESIGN • Low Coupling • High Cohesion • High Encapsulation • SOLID Wednesday, October 29, 14
  • 39. TDD WORKFLOW • New code • Legacy • Bugs Wednesday, October 29, 14
  • 40. NEW CODE Wednesday, October 29, 14
  • 41. STORY SAMPLE • As a Standard User I need to see my list of outstanding orders, so I can review and complete them in priority order Wednesday, October 29, 14
  • 42. STORY SAMPLE • As a Standard User I need to see my list of outstanding orders, so I can review and complete them in priority order Wednesday, October 29, 14
  • 43. STORY SAMPLE • As a Customer I need to calculate the tip for my bill, so I can save time and include a reasonable amount Wednesday, October 29, 14
  • 44. TEST CODE Wednesday, October 29, 14
  • 47. LEGACY • first, do no harm • get sufficient coverage in place • confirm existing functionality is correct • review tests cases with team Wednesday, October 29, 14
  • 48. TEST FIRST, REFACTOR LATER I’M SERIOUS!! Wednesday, October 29, 14
  • 49. CODE SAMPLE Wednesday, October 29, 14
  • 50. BUGS • write a test to confirm the bug • change the code to fix the bug • the test should confirm the fix Wednesday, October 29, 14
  • 52. PROS • Focus • Confidence • Rapid Feedback • Clear intention • Executable documentation Wednesday, October 29, 14
  • 53. CONS • TDD is HARD!! • Refactoring is an uncertain art • Some parts are hard to test first • False sense of security • Focus more on the tests than the system! Wednesday, October 29, 14
  • 54. ANTI-PATT3RNS • huge setup, reused unnecessarily • too much going on in one test • only testing happy-path, not exceptions • too much boiler-plate, basic tests • over-mocking: “tests pass, but production is broken” • not doing the ‘refactor’ part of Red/Green/Refactor Wednesday, October 29, 14
  • 57. CONTROVERSY • Used to love and promote TDD • Dogmatic TDD is not helpful • Focusing exclusively on speed and low-coupling • Shaming others for not following “TDD or Die!” Wednesday, October 29, 14
  • 58. SUMMARY • Tests are worth the investment • Everyone on the team should care about them • TDD is a great way to improve your code and tests • Find an approach that works best for your team Wednesday, October 29, 14
  • 59. RESOURCES • TDD is Dead - David Heinemeier-Hansson • R.I.P. TDD - Kent Beck • TDD “straw-men and rhetoric” - Gary Bernhardt • Failures of “Intro to TDD” - Justin Searls • Pragmatics of TDD - ‘Uncle’ Bob Martin • When to Mock - ‘Uncle’ Bob Martin • TDD Failed to become mainstream • TDD a Love-Story - Nell Shamrell Wednesday, October 29, 14
  • 60. LET’S HAVE SOME QUESTIONS! John McCaffrey @ J_McCaffrey Wednesday, October 29, 14