Professional Documents
Culture Documents
Kevin Klinemeier
Agile Trainer and Coach Software Developer / Architect / Tester @agilekevin kevin@davisbase.com
Agenda
TDD Overview Expected Values Test Driven Design Additional tools Getting Started
TDD
Spend ~3 days writing tests, then start the real work. Tell your PMO you need more time Fire your QA staff: no manual testing or system needed
Unit Testing
Testing of units, by code
One class or method Very few dependencies
Red-green-refactor
CreateaTest
Pass
RunaTest
Fail
MakeaChange
Change is stability
RuntheTest
Pass
Refactor
Value
Why First? Why in Agile, when we could never justify it before?
Source: Succeeding With Agile: Software Development using Scrum, Mike Cohn
Value
Without TDD
Dynamic Mocks
Run-time implementation of interfaces
Example:
We want to test AccountService, but it needs an ICurrencyService. The concrete ICurrencyService needs lots of stuff. The ICurrencyService itself has 50 methods.
mocks = new Mockery(); mockCurrencyService = mocks.NewMock<ICurrencyService>(); accountService = new AccountService(mockCurrencyService); Expect.Once.On(mockCurrencyService). Method("GetConversionRate"). With("GBP", "CAD"). Will(Return.Value(2.20));
Continuous Integration
Scripted Build Integra on Build Machine Transparency & Con nuous Builds Automated Unit Tes ng
CI
Server
Code Coverage
Track progress Target improvements Blame your coworkers
BDD
System Testing, System Integration Testing, and GUI Testing: TDD-style Toolset to parse natural language into automated actions, execute and report results Focuses on business-readable input and output. Maybe even business-writeable. Given (preconditions) When (actor+action) Then (observable result)
Getting Started
Practice Stick with it for at least 3 weeks Dont go it alone Measure progress & gaps with code coverage Expect learning pains
Your Questions
For any questions we arent able to cover, Ill be providing a written response.