110 likes | 254 Views
TDD by example. Pierre-Emmanuel DAUTREPPE – October 26th 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 « DotNetHub »
E N D
TDD by example Pierre-Emmanuel DAUTREPPE – October 26th 2012 Whyshallwe test ? Whatis TDD (Test DrivenDevelopment) ? Let’s practice ittogetherdoing a kata...
Pierre-Emmanuel DAUTREPPE • « .NET Architect » and « XP Coach » • Founder of • User Group « DotNetHub » • « La Journée Agile »/« Agile Tour Namur » • Me contacter via : • pierre@dotnethub.be • http://www.pedautreppe.com • http://www.dotnethub.be • @pedautreppe
Our developer life We = developers commentedit documentedit Turk et De Groot • That functionalityyouimplemented, you have ? • No, that’suseless ! It’s trivial ! • … • … • … doesn’twork … • ???? testedit n00b We are genious ! (generallymisunderstood)
Our developer life Just use a safetynet ! PinderCircus
…but also a documentation tool… It’swritten « Sort out yourownproblems ! » Hereis a prettyclearuser manual
The « Test DrivenDevelopment » Cycle • Write a test • Refactoring of tests • Refactoring • It does not compile • Refactoringof code • Test passes • Writeneeded API • Implement • Test compiles • but fail
Conclusion • Follow the TDD rules • Be iterative: split yourwork in small (requirement) increments • Alwaysstart by writing a test • Thenimplementuntill the test passes • And Cleanup! (refactor) • TDD let you use tests as • A validation tool • A documentation tool • A design tool