everybody is happy • And here you are asked to implement the new feature • Problem – DO NOT BREAK THE CODE – During development – During bug fixing – During refactoring Akim Khalilov Production code without tests 2
be violated • Long methods / classes – God object • Static calls • Dependency from the external resources Akim Khalilov Production code without tests 4
static • Exclude static call in the test • Extract And Override Call • Subclass And Override • DEMO #2 – The Seam Model Akim Khalilov Production code without tests 6
of tests should I write • Characterization test: – Documents current code behavior – Exclude any «I think, «Maybe the code works this way..» • Write the red test. Error will show you what returns from the method • If the result is illogic – take to the look (Bug?) • Every new test: – Documents the function: What does that method do? – RTFM Test – Helps make changes without fear Akim Khalilov Production code without tests 9
• Tests will save your back in the future • Team knows code better • The system is under refactoring Akim Khalilov Production code without tests 10 • HDD - Hope Driven Development? • FDD - Faith Driven Development? • JDD - Jesus Driven development? • PDD - Pray Driven Development?