3. repeittion of very
What is TDD ?
short dev cycle of 3
steps
test come from story
refactor
changing source
without modifying
external functional Software development process in 3 steps
behavior
4. because you have to design the
component before you code,
TDD in short
and note design the component
while you code
• Encourages simple design (Ken Beck)
• Relies on automated unit testing
• Builds a harness against software regression
5. although required,
dependencies and
Testing and
collaborators
collaborators needs to be
replace by somethin
• Testing a unit of code is not testing its
collaborators
• Collaborators have to be reproduced and
controlled to produce expected results so
tests can run => enter mocks !
6. Stubs and mocks stub on existing code
or yet to be code
mock help to test
behavior
• A stub (or method stub) returns
programmed results when called
• A mock (or mock object) mimics a real
object. It has the same interface as the real
objects it mimics.
• Mocks methods can be stubbed