TDD by example PierreEmmanuel DAUTREPPE October 26 th

  • Slides: 11
Download presentation
TDD by example Pierre-Emmanuel DAUTREPPE – October 26 th 2012 Why shall we test

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

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 : Ø [email protected] be Ø http: //www. pedautreppe. com Ø http: //www. dotnethub. be Ø @pedautreppe 2

Our developer life n We are genious ! (generally misunderstood) We = developers Turk

Our developer life n We are genious ! (generally misunderstood) We = developers Turk et De Groot Ø Ø Ø commented it documented it 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 4

Our developer life Just use a safety net ! Pinder Circus 5

Our developer life Just use a safety net ! Pinder Circus 5

Tests are a validation tool… 6

Tests are a validation tool… 6

…but also a documentation tool… Here is a pretty clear user manual It’s written

…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

…and a design tool 8

The « Test Driven Development » Cycle Re f of act te or st

The « Test Driven Development » Cycle Re f of act te or st ing s Write a test Re f of act c or od in e g Refactoring Test passes Implement It does not compile Write needed API Test compiles but fail 9

13

13

Conclusion n TDD let you use tests as ü A validation tool ü A

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