TDD by example Why shall we test ? What is TDD (Test Driven Development) ? Lets practice it together...

Post on 30-Mar-2015

218 views 0 download

Tags:

Transcript of TDD by example Why shall we test ? What is TDD (Test Driven Development) ? Lets practice it together...

TDD by example

Why shall we test ?What is TDD (Test Driven Development) ?Let’s practice it together doing a kata...

Pierre-Emmanuel DAUTREPPE – October 26th 2012

2

« .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

Pierre-Emmanuel DAUTREPPE

3

Our developer life

We are genious ! (generally misunderstood)

We = developers

That functionality you implemented, you have ? No, that’s useless ! It’s trivial ! … … … doesn’t work … ????

n00b

documented itcommented it

tested it

Turk et De Groot

4

Our developer life

5

Our developer life

Pinder CircusJust use a safety net !

6

Tests are a validation tool…

7

…but also a documentation tool…

Here is a pretty clear user manual

It’s written « Sort out your own

problems ! »

8

…and a design tool

9

The « Test Driven Development » Cycle

Refactoring

Test passes

Implement Test compiles but fail

Write needed API

It does not compile

Write a testRef

acto

ring

of te

sts

Refac

torin

g

of c

ode

13

14

Conclusion

TDD let you use tests as A validation tool A documentation tool A design tool

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)