Process
Test versus Design Red, Green, Refactor No Production Code without a Failing
Test State Based versus Interaction Based
Tests
Flavors
Behavior-Driven Development Domain-Driven Design Acceptance-Test Driven Development Feature-Driven Development Example-Driven Development Hope-Driven Development
Techniques - Tools
xUnit Tools .NET – NUnit, MbUnit, xUnit.NET, Visual
Studio Test Tools, TD.NET, Resharper Java – JUnit, JBehave Ruby – test_unit, rSpec, Cucumber
Other Tools FitNesse/FIT AgileDocs/TestDocs
Techniques – Rules
Two main sources of “rules” Feather’s Rules – from Michael Feathers’
Working Effectively with Legacy Code North’s Rules – from Dan North’s BDD
sessions
Techniques – Feathers’ Rules Not a unit test if it
Talks to the database Communicates Across the Network Touches the File System Can’t run at the same time as your other
unit tests Have to do special things in your
environment to run it (config file changes, code changes, etc)
Techniques – North’s Rules
Come from Behavior-Driven Development Test Method Names should be sentences Keep Test Methods Focused It should be clear from the name what
the test is doing “Behavior” is more useful than “test” Acceptance Criteria should be executable BDD is an umbiqutious language for
analysis
Techniques - Spikes
When it absolutely, positively has to be there without tests
Useful for determining if something is even going to work
Timebox the Spike Throw away the code at the end and
redo it test-first
Techniques – Helpful Patterns Dependency Injection Separation of Concerns MVP/MVC
Model View Presenter Model View Controller
Demo
TDD / MVC Demo Starring
Michael Russo as “Newbie” Cory Foy as “Cory” The audience as “The Hecklers”
Introducing TDD
Legacy Code Pick up a copy of Working Effectively With
Legacy Code Write unit tests for bugs Write Characterization tests for features
Greenfield Project No production code without a failing test Executable Specifications Automated Acceptance Test Criteria
Challenges
Language Support Slow Tests Keeping up with the tests Developer Mindsets Management Mindsets Legacy Code
Questions?
Ask now Or, you know, ask later, afterwards, or
via email, or twitter, or we’ll give you our phone numbers. Come over for dinner. We’ll chat more then.
Top Related