SlideShare une entreprise Scribd logo
1  sur  54
Test Driven Development
                       Blueprint, Toolbox, and Master Craft




                                                                                                                                                            Stephen Ritchie
                                                                                                                                                                  April 1, 2013



Stephen D. Ritchie – Managing Consultant – Excella Consulting, Inc., 2300 Wilson Blvd, Suite 630, Arlington, VA 22201 – 703.840.8600 – http://excella.com
Live Tweet, Slides and Examples

• Twitter: @RuthlessHelp
           @Apress

• Slides:
  http://www.slideshare.net/ruthlesshelp

• Code Samples:
  http://github.com/ruthlesshelp
Stephen D. Ritchie   2
Blueprint




Stephen D. Ritchie   3
Toolbox




Stephen D. Ritchie   4
Master Craft




Stephen D. Ritchie   5
Motivation



                     Why test
                     software?
Stephen D. Ritchie       6
Motivation




Stephen D. Ritchie   7
Blueprint

                                    1

                                Red



                                                2

                     Refactor           Green
                     3




Stephen D. Ritchie              8
Blueprint

0. Think
1. Write Test Code
2. Write Production Code
3. Refactor
Repeat 12–40+ cycles/hr
Stephen D. Ritchie   9
Blueprint

                     0. Think




Stephen D. Ritchie        10
Blueprint

                     1. Red




Stephen D. Ritchie        11
Blueprint

                     2. Green




Stephen D. Ritchie        12
Blueprint

                     3. Refactor




Stephen D. Ritchie        13
Blueprint

                     Repeat




Stephen D. Ritchie       14
Automated Tests
  Make Sure
Software Works
As You Intended
But wait …




Stephen D. Ritchie   16
Temperature Conversion




Stephen D. Ritchie   17
Temperature Conversion

Specification By Example
Start Where You Start
Debug As You Go
Safely Refactor
Engaging (Fun?)
Stephen D. Ritchie   18
TDD Katas

•    Bowling Score
•    Roman Numerals
•    Tennis Score
•    Conway's Game of Life

• Kata Sites:
     http://en.wikipedia.org/wiki/Kata_(programming)


Stephen D. Ritchie         19
But wait …




Stephen D. Ritchie   20
TDD: Quality, Visibility, Etc.

•    Focus on Requirements
•    Clear, Simple, & Testable
•    Documents Code’s Behavior
•    Suite of Regression Tests
•    Enables & Liberates Change
•    Visibility (KPI)
       – Number of Passing Tests
       – % Code Coverage
• Problem Prevention

Stephen D. Ritchie           21
But wait …




Stephen D. Ritchie   22
TDD: Agility

                     http://amzn.to/172CrtT




Stephen D. Ritchie   23
TDD: Agility

• Easier Debugging
• Personal Process
       – Easy to Get Started
       – Easy to Keep Going
• Detailed Design Do-Overs
• What Was I Thinking?
       – What Was That Bozo Thinking?
• Hey, Your API Doesn’t Work
Stephen D. Ritchie             24
But wait …




Stephen D. Ritchie   25
TDD: Legacy Code

                     http://amzn.to/YMpZhl




Stephen D. Ritchie   26
TDD: Legacy Code

•    Assembly Coverage
•    Class Coverage
•    Method Coverage
•    Branch Coverage
•    Boundary Analysis
•    100% Code Coverage



Stephen D. Ritchie   27
Toolbox


                     TDD Books



Stephen D. Ritchie        28
TDD: Big Picture

                     http://amzn.to/10YXE5a




Stephen D. Ritchie   29
TDD: The Art

                     http://amzn.to/XLOt4b




                     Second Edition:
                     http://bit.ly/XLOZz0


Stephen D. Ritchie   30
Toolbox


                     Testing Framework

      Run Tests
       Make Assertions
Stephen D. Ritchie        31
MSTest



   - 32 -
MBUnit



   - 33 -
xUnit.net



      - 34 -
NUnit



http://www.nunit.org/
                        - 35 -
Toolbox


                     Mocking Framework

      Isolation
       Interaction Testing
Stephen D. Ritchie        36
Rhino Mocks



        - 37 -
Moq



http://bit.ly/ZHjQQ0
                       - 38 -
Unit Testing




Stephen D. Ritchie   39
The Master Craft


                     Continuous Integration

      Automation
       Monitoring
Stephen D. Ritchie          40
CI Servers




Stephen D. Ritchie   41
CI in .NET

                     http://amzn.to/10mXYIt




Stephen D. Ritchie   42
The Master Craft


                     Code Coverage

      Find Missing Tests
       Monitoring
Stephen D. Ritchie         43
Toolbox


                     dotCover


       http://www.jetbrains.com/dotcover/



Stephen D. Ritchie           44
Toolbox


                     Open Cover


       http://nuget.org/packages/OpenCover



Stephen D. Ritchie          45
The Master Craft




       http://www.ncover.com/



Stephen D. Ritchie          46
The Master Craft


                     Inversion of Control
Dependency Injection
IoC Containers
MSDN Article: http://bit.ly/172KUxg
Stephen D. Ritchie         47
Toolbox


                     Autofac


       http://code.google.com/p/autofac/



Stephen D. Ritchie           48
The Master Craft




Stephen D. Ritchie   49
Of Course It’s Safe … After You
Shameless Self Promotion Time!

                            • “Best Practices” Initiative
                            • Tips and Tricks
                            • Generate Ideas
                              – Quantifying Value
                              – Biases & Aversions
                              – Tools & Technologies
    http://amzn.to/v8TD8E
                            • Avoid Making the Same
                              Mistakes Once.

Stephen D. Ritchie              52
Shameless Self Promotion Time!

                     • 40% off eBook at
                       Apress.com
                      http://www.apress.com/9781430240235



                     • Use promo code:
                       FWUG40

                     • Offer expires 1-May-
                       2013

Stephen D. Ritchie       53
Stephen’s Contact Info

• Twitter: @RuthlessHelp

• Email: stephen.ritchie@excella.com

• Blog:              http://ruthlesslyhelpful.net

• LinkedIn:
     http://www.linkedin.com/in/sritchie

Stephen D. Ritchie              54

Contenu connexe

En vedette (6)

Assessment (Blueprint)
Assessment (Blueprint)Assessment (Blueprint)
Assessment (Blueprint)
 
Blueprint ppt
Blueprint pptBlueprint ppt
Blueprint ppt
 
How to make table of specs
How to make table of specsHow to make table of specs
How to make table of specs
 
Blueprint of exam questions
Blueprint of exam questions Blueprint of exam questions
Blueprint of exam questions
 
Blueprint in education
Blueprint in educationBlueprint in education
Blueprint in education
 
Graphical Representation of data
Graphical Representation of dataGraphical Representation of data
Graphical Representation of data
 

Similaire à Test Driven Development: Blueprint, Toolbox, and Master Craft

Similaire à Test Driven Development: Blueprint, Toolbox, and Master Craft (20)

Advanced Code Analysis with .NET
Advanced Code Analysis with .NETAdvanced Code Analysis with .NET
Advanced Code Analysis with .NET
 
Advanced Code Analysis In .NET
Advanced Code Analysis In .NETAdvanced Code Analysis In .NET
Advanced Code Analysis In .NET
 
DevOps Requires Agility
DevOps Requires AgilityDevOps Requires Agility
DevOps Requires Agility
 
Continuous Integration: Blueprint, Toolbox, Master Craft
Continuous Integration: Blueprint, Toolbox, Master CraftContinuous Integration: Blueprint, Toolbox, Master Craft
Continuous Integration: Blueprint, Toolbox, Master Craft
 
Continuous Integration: Blueprint, Toolbox, Master Craft
Continuous Integration: Blueprint, Toolbox, Master CraftContinuous Integration: Blueprint, Toolbox, Master Craft
Continuous Integration: Blueprint, Toolbox, Master Craft
 
Continuous Integration: Toolbox, Blueprint, Master Craft
Continuous Integration: Toolbox, Blueprint, Master CraftContinuous Integration: Toolbox, Blueprint, Master Craft
Continuous Integration: Toolbox, Blueprint, Master Craft
 
ContinuousDelivery-101
ContinuousDelivery-101ContinuousDelivery-101
ContinuousDelivery-101
 
api-driven-development.pdf
api-driven-development.pdfapi-driven-development.pdf
api-driven-development.pdf
 
Metrics for aglie teams
Metrics for aglie teamsMetrics for aglie teams
Metrics for aglie teams
 
Transferring Software Testing Tools to Practice
Transferring Software Testing Tools to PracticeTransferring Software Testing Tools to Practice
Transferring Software Testing Tools to Practice
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
 
What the Heck Is a Product Owner?
What the Heck Is a Product Owner?What the Heck Is a Product Owner?
What the Heck Is a Product Owner?
 
Leveling up Developers
Leveling up DevelopersLeveling up Developers
Leveling up Developers
 
Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...
Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...
Kelly O'Briant - DataOps in the Cloud: How To Supercharge Data Science with a...
 
Oscon 2016: open source lessons from the todo group
Oscon 2016: open source lessons from the todo groupOscon 2016: open source lessons from the todo group
Oscon 2016: open source lessons from the todo group
 
Technical Excellence Doesn't Just Happen--Igniting a Craftsmanship Culture
Technical Excellence Doesn't Just Happen--Igniting a Craftsmanship CultureTechnical Excellence Doesn't Just Happen--Igniting a Craftsmanship Culture
Technical Excellence Doesn't Just Happen--Igniting a Craftsmanship Culture
 
Open Source Lessons from the TODO Group
Open Source Lessons from the TODO GroupOpen Source Lessons from the TODO Group
Open Source Lessons from the TODO Group
 
Achieving Technical Excellence in Your Software Teams - from Devternity
Achieving Technical Excellence in Your Software Teams - from Devternity Achieving Technical Excellence in Your Software Teams - from Devternity
Achieving Technical Excellence in Your Software Teams - from Devternity
 
GDSC NYCU | 如何建立自己的開源專案
 GDSC NYCU | 如何建立自己的開源專案 GDSC NYCU | 如何建立自己的開源專案
GDSC NYCU | 如何建立自己的開源專案
 
Finding Your Organization’s Code Deodorant
Finding Your Organization’s Code DeodorantFinding Your Organization’s Code Deodorant
Finding Your Organization’s Code Deodorant
 

Plus de Stephen Ritchie

DCDNUG 10/16/2012 Automated testing obstacles pitfalls dangers
DCDNUG 10/16/2012 Automated testing obstacles pitfalls dangersDCDNUG 10/16/2012 Automated testing obstacles pitfalls dangers
DCDNUG 10/16/2012 Automated testing obstacles pitfalls dangers
Stephen Ritchie
 
Automated Testing: Obstacles, Pitfalls, and Dangers
Automated Testing: Obstacles, Pitfalls, and DangersAutomated Testing: Obstacles, Pitfalls, and Dangers
Automated Testing: Obstacles, Pitfalls, and Dangers
Stephen Ritchie
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
Stephen Ritchie
 

Plus de Stephen Ritchie (13)

Overview of .NET Best Practices
Overview of .NET Best PracticesOverview of .NET Best Practices
Overview of .NET Best Practices
 
Lightweight Documentation
Lightweight DocumentationLightweight Documentation
Lightweight Documentation
 
Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015
 
Lightweight Documentation: An Agile Approach
Lightweight Documentation: An Agile ApproachLightweight Documentation: An Agile Approach
Lightweight Documentation: An Agile Approach
 
Continuous Integration: Blueprint, Toolbox, Master Craft
Continuous Integration: Blueprint, Toolbox, Master CraftContinuous Integration: Blueprint, Toolbox, Master Craft
Continuous Integration: Blueprint, Toolbox, Master Craft
 
Dc scrum agile_eng_20130923
Dc scrum agile_eng_20130923Dc scrum agile_eng_20130923
Dc scrum agile_eng_20130923
 
Agile Testing Best Practices
Agile Testing Best PracticesAgile Testing Best Practices
Agile Testing Best Practices
 
An Overview of .NET Best Practices
An Overview of .NET Best PracticesAn Overview of .NET Best Practices
An Overview of .NET Best Practices
 
Overcoming the Obstacles, Pitfalls, and Dangers of Unit Testing
Overcoming the Obstacles, Pitfalls, and Dangers of Unit TestingOvercoming the Obstacles, Pitfalls, and Dangers of Unit Testing
Overcoming the Obstacles, Pitfalls, and Dangers of Unit Testing
 
An Overview of .NET Best Practices
An Overview of .NET Best PracticesAn Overview of .NET Best Practices
An Overview of .NET Best Practices
 
DCDNUG 10/16/2012 Automated testing obstacles pitfalls dangers
DCDNUG 10/16/2012 Automated testing obstacles pitfalls dangersDCDNUG 10/16/2012 Automated testing obstacles pitfalls dangers
DCDNUG 10/16/2012 Automated testing obstacles pitfalls dangers
 
Automated Testing: Obstacles, Pitfalls, and Dangers
Automated Testing: Obstacles, Pitfalls, and DangersAutomated Testing: Obstacles, Pitfalls, and Dangers
Automated Testing: Obstacles, Pitfalls, and Dangers
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Test Driven Development: Blueprint, Toolbox, and Master Craft

Notes de l'éditeur

  1. Testing FrameworkMSTest
  2. Testing FrameworkMbUnit
  3. Testing FrameworkxUnit.net
  4. Testing FrameworkNUnit
  5. Mocking FrameworkRhinoMocks
  6. Mocking FrameworkMoq