Test Driven Development driving the development of quality software through tests presented by
Introduction and Agenda Andy Painter, Davisbase Consulting 15+ years in software development. 5+ years working with software development teams, training, leading, and coaching Agile teams. Trained and coached teams ranging from start-ups to Fortune 50 corporations. Agenda What is Test Driven Development? Why write tests first? Success Patterns & Challenges Next steps
Cost of Defects 20000 15000 10000 5000 0 Requirements Design Development Tes6ng Maintenance Catch Defects Early in the Lifecycle during design & development phases to lower TCO in short term (current release) and long term (future releases)
Agile Testing Quadrants Q2 Q1 Q3 Q4 Source: Agile Testing by Lisa Crispin & Janet Gregory
Agile Testing Quadrants Q2 Q1 Q3 Q4 Source: Agile Testing by Lisa Crispin & Janet Gregory
Test Driven Development (TDD) Test cases, testing harnesses, testing scripts are written before any coding begins. Refactoring and development of code until testing scripts run all green. Requires developers to think of the larger solution and approach to be developed before coding begins. Benefits: more testing integrated into development efforts, higher quality code delivered, decrease amounts of code rework later in project cycle.
Red, Green, Refactor Create a Test TDD Rhythm Pass Run a Test Fail Make a Change Run the Test Refactor Pass Fail Write a Test that fails Write some code to satisfy the test Run the Test Refactor
Building a Strong Base Small in number Tools: Selenium, Watir, QTP At least one per Story Tools: FIT/Fitnesse, BDD At least one per class or module Tools: JUnit, xunit Source: Mike Cohn
Upfront & Shared Commitment Perceived as more costly due to increased investment of time up front Requires significant discipline amongst the team Best success when the team is committed together
Benefits More efficient code is written...code to pass the test Reduces gold plating
Automate Early & Often Automate Early & Often Get the benefits when you need it most Cost will prohibit adoption later as benefits are not easy seen Source: Succeeding with Agile: Software Development using Scrum, Mike Cohn
Continuous Unit Testing Scripted Build Integra1on Build Machine CI Integration Build Machine Transparency & Con1nuous Builds Automated Unit Tes1ng Server
Development without TDD Time
Test Last Approach Time
Test Last in Parallel Time
Test Driven Development Time
Test Driven Design Time
Sustainable TDD Drives Simple Design Reduces Gold Plating Continuous & Automated Rapid Feedback Supports New Development Unit Test (TDD) Time Refactoring Future Development
7 Wastes or SW Development Partially Done Work Extra Features Relearning Handoffs Task Switching Delays Defects
7 Wastes or SW Development Partially Done Work Extra Features Relearning Handoffs Task Switching Delays Defects Examples of Partially Done Work: Un-coded Documentation Untested Code Undocumented Code Tests replace documentation They are TESTS!
7 Wastes or SW Development Partially Done Work Extra Features Relearning Reduced gold plating Only develop code that satisfies the tests Handoffs Task Switching Delays Defects
7 Wastes or SW Development Partially Done Work Extra Features Relearning Handoffs Tests provide a excellent source of documentation and usage patterns Always up-to date Facilitates Ping-Pong pairing Task Switching Delays Defects
7 Wastes or SW Development Partially Done Work Extra Features Relearning Finer grained tasks minimize potential for interruption Imbedded Context Dump Handoffs Task Switching Delays Defects
7 Wastes or SW Development Partially Done Work Extra Features Relearning Handoffs Finer grained tasks increases the frequency of feedback Allows mocking of external systems & dependencies to maintain positive momentum Task Switching Delays Defects
7 Wastes or SW Development Partially Done Work Extra Features Relearning Handoffs Increases probability of early defect detection Use tests to drive defect resolution and narrow the scope (DDD) Task Switching Delays Defects
Symbiotic Agile Engineering Practices Pairing/Collaboration Coding Standards Refactoring Collective Code Ownership Continuous Integration
Building Successful Habits Write Test Firsts Make Small Changes Commit Often Don't commit broken code Fail the build if any test fails Fix broken builds immediately Embrace Continuous Integration Measure Code Coverage Run Local Builds before commits Don't check out code from a broken build
Other Forms of TDD Acceptance Test Driven Development (ATDD) Behavior Driven Development (BDD) Small in number Tools: Selenium, Watir, QTP At least one per Story Tools: FIT/Fitnesse, BDD At least one per class or module Tools: JUnit, xunit
Getting Started Practice Stick with it for at least 3 consecutive weeks Don t go it alone Measure progress & gaps with code coverage Expect learning pains
References
Your Questions, My Answers For those questions we do not have time to answer during the webinar, I will be providing a written response.
About Us A leading, national provider of Agile training and coaching services. Since 2007, over 300 classes taught to over 5000 people nationwide. Training, coaching, and consulting work for over 50 Fortune 500 Clients. Experienced; in the trenches doing what we teach Extensive experience with all aspects of software development and project lifecycle across multiple industries and verticals. Every title and role from Developer, QA, Project Manager through Sr. Leadership. Average of 14+ years of applied IT Leadership experience.