7. Testing
● Say it once, check every time automatically.
○ “Don’t do repetitive checks”
● Increase reliability and quality of software.
○ “I didn’t think of that!”
● Discover regressions in software.
○ “Why did it break?”
● Improve confidence in our code.
○ “I think this will work.”
20. Testing
Without behaviour
● Dummy -> no content
● Stub -> to guide the test
With behaviour
● Fake -> to simulate
● Spy -> a call has been made
● Mock -> ensure expectation
22. Testing
● Global can not be substituted
○ Avoid static and singleton
● It’s easier to fake collaborators
○ Composition over inheritance
○ Isolate dependencies
○ Inject dependencies
● It’s easier to test small and one-responsibility classes
○ Single responsibility principle