Video: TDD, Where Did It All Go Wrong - Ian Cooper
TDD, Where Did It All Go Wrong - Ian Cooper
Ian Cooper - TDD, Where Did It All Go Wrong
Trigger for writing test
!= new method
!= new class
= requirement
test api
System Under Test (SUT) != class
Unit test -> exports of module
refactoring = separate implementation detail from things you do need to test
extra
"The word 'test' in TDD confuses people about how to do TDD, when I change it to Behavior, it tends to be better understood"
-- Dan North
todo: re-read 'TDD by example'
design clean api first, then realistic
test is first consumer of your code
unit of isolation = test, not sut
===
RED-GREEN-REFACTOR
1) write test that fails without implementation
2) make test pass asap, sinful, ducttape
line by line
not nice classes, no patterns
speed > design
3) make good code
"""
You can't do 2 things at once easily
- understand the solution to the problem
- engineer the code right
You will either
- over-engineer
- analysis-paralysis
"""
===
CLEAN CODE WHEN
refactoring
don't write tests
private/internal visibility
only in the refactoring step
now I know I need it
===
HEXAGONAL ARCHITECTURE
PORTS AND ADAPTERS
===
GEARS
throw away helping tests with implementation details when implemented
===
ACCEPTANCE TDD
Don't do it
- customers are not interested
- they're expensive
Maybe you need it, because programmer tests don't focus on the gist of the system.
===
MOCKS
===
SUMMARY