TDD by example PierreEmmanuel DAUTREPPE October 26 th
TDD by example Pierre-Emmanuel DAUTREPPE – October 26 th 2012 Why shall we test ? What is TDD (Test Driven Development) ? Let’s practice it together doing a kata. . .
Pierre-Emmanuel DAUTREPPE ü «. NET Architect » and « XP Coach » ü Founder of Ø User Group « Dot. Net. Hub » Ø « La Journée Agile » / « Agile Tour Namur » ü Me contacter via : Ø pierre@dotnethub. be Ø http: //www. pedautreppe. com Ø http: //www. dotnethub. be Ø @pedautreppe 2
Our developer life n We are genious ! (generally misunderstood) We = developers Turk et De Groot Ø Ø Ø commented documenteditit That functionality you implemented, you have tested it No, that’s useless ! It’s trivial ! n 00 b … … … doesn’t work … ? ? ? 3
Our developer life 4
Our developer life Just use a safety net ! Pinder Circus 5
Tests are a validation tool… 6
…but also a documentation tool… Here is a pretty clear user manual It’s written « Sort out your own problems ! » 7
…and a design tool 8
The « Test Driven Development » Cycle Re f of act te ori st ng s Write a test Re f of act co ori de ng Refactoring Test passes Implement It does not compile Write needed API Test compiles but fail 9
13
Conclusion n TDD let you use tests as ü A validation tool ü A documentation tool ü A design tool n Follow the TDD rules ü Be iterative: split your work in small (requirement) increments ü Always start by writing a test ü Then implement untill the test passes ü And Cleanup! (refactor) 14
- Slides: 11