4. Introduction
Goal
Common vocabulary
Defining next actions
About
GFDL
on github
libre tools
Sources
Working Effectively with Legacy Code Micheal C. Feathers
xUnit Test Patterns Gerard Meszaros
Kata Casts
Pragmatic Unit Testing in Java Andy Hunt, Dave Thomas
6. Definitions
Unit test
WELC : A test that runs in less than 1/10th of a second and is
small enough to help you localize problems when it fails.
XTP : A test that verifies the behavior of some small part of
the overall system.
wikipedia : In computer programming, unit testing is a method
by which individual units of source code are tested to determine
if they are fit for use. A unit is the smallest testable part of an
application.
Component Test :
Component :
More granular
Self contained
Clear responibillity
(deployable)
SUT : System Under Test
7. Good Unit Tests
Run fast
6000 classes => 6000 test fixtures
Avg. 3 test/fixture = 18.000 tests
Acceptable runtime 2-3 min. => 0.01 s/test
Help localize problems
Help improve quality
Help understand SUT
Reduce (and not introduce) risk
Are easy to run
Are easy to write and maintain
10. Good Unit Tests are A TRIP
Automatic
Thorough
Repeatable
Independent
Professional
pragmatic unit testing summary card
11. It ain’t a Unit Test when
It talks to a database
It communicates across a network
It touches the filesystem
It starts other processes
It starts other threads
It calls Thread.Sleep(. . . )
14. Inspiration
Positive filter
Watch flow, kadanz
Code Kata by Robert C. Martin aka Uncle Bob
ruby
calculate the list of primes that divide of a given number
Katacast Uncle Bob Prime Factors