tdd for tekna
TRANSCRIPT
Why Test Driven Development has little to do with testingby Espen Dalløkken. October 23 2008, Tekna, Oslo, Norway
http://www.flickr.com/photos/nathan_adams/2401072076
Ab o u t m e
● Espen Dalløkken, 13.11.1976● Graduate of Molde College● Software Developer since 1998● Started with TDD in 2004
Ag e nd a
● Why TDD has little to do with testing
● Myths About TDD● Three Benefits Of TDD● How you introduce TDD in your
organization
H o w I W a s In t ro d uc e d To TDD
Te s t ing is fun !
http://www.flickr.com/photos/azlijamil01/469730066/
? ? ?
Te s t ing is fun !!
http://www.flickr.com/photos/azlijamil01/469730066/
#$ %!
The o ry Ab o u t Te s t ing
Ph ilo s o p hy
● Testing is to prevent defects from occurring, not finding them
● Do it right the first time(use TDD and continuous integration)
● QA staff should build quality into code, rather than test
B u ild ing Qua lit y In
● Involve testers in writing tests up front to provide an executable specification
● Mistake-proof your process by automating testing as much as possible
● Stop the line and fail fast
C o s t O f Fix ing De fe c ts
Source: IBM Systems Sciences Institute
Te s t D r ive n De ve lo p m e n t
W hy TDD ha s lit t le to d o w ith te s t ing
● Puts focus on requirements● Encourages simplicity in design● Enforces loosely coupled
components● Encourages good Object Oriented
Design
W hy TDD ha s lit t le to d o w ith te s t ing
● Makes your code-base fit for handling change
● A safety net when refactoring code
● Enforces technology which is testable
Thre e B e ne fit s O f TDD
TDD p ro v id e s c o n t inuo us
im p ro ve m e nts , w h ic h g ra d ua lly
im p ro ve s the q ua lit y o f yo u r c o d e b a s e
TDD m a ke s yo u fa il fa s t , w h ic h
he lp re d uc e te s t ing c o s ts
TDD re q u ire s lo o s e ly c o up le d c o m p o ne n ts , w h ic h a re a ne c e s s it y
fo r a n e vo lv ing a rc h ite c tu re
The M yths o f TDD
N o N e e d To C ha ng e The W a y W e W o rk
W e N e e d C ha ng e B e c a us e ..
● Too much time is spent on acceptance testing in projects
● Defects keeps on reoccurring● Developers don't take enough
responsibility for testability of their application
TDD is s lo w
TDD Is Fa s t B e a c a us e ..
● You go faster by not having to go back
● You write only code you need● It helps prevent reoccurring
defects● Tests document how
requirements is implemented
In t ro d uc ing TDD to a d e ve lo p m e n t
te a m
Pro b le m s yo u w ill e nc o un te r
● People in general don't like change, but developers tends to hate it
● No developer likes the word “testing”
● Realizing the value of TDD takes time and practice
H o w To In t ro d uc e TDD
● Lead by example● Follow up all developers● Focus upon development benefits● Automate the build and test
process
De ve lo p e r B e ne fit s
● Have a Continuous Integration stack set up
● TDD on bug fixing, means fixing bugs once
● Refactoring can be performed any time in the project life cycle
W r it ing Te s t Up Fro n t ...
● Helps you write only required code
● Helps you create a loosely coupled design from day 1
● Helps you document your application
● Help putting focus on requirements
H o w Yo u Fe e l Ab o u t TDD?
http://www.flickr.com/photos/zilliontrillion1/276600545