Mark Ethan Trostler (@zzoass) writes and tests code for a living, currently at Google. The veteran coder and author of Testable JavaScript recently delivered a comprehensive lesson on writing and maintaining testable code to some 400 folks from around the globe. In one hour Trostler detailed methods for swapping implementations, writing tests once, and working/testing in parallel.
You’ll probably want to watch his free webcast from beginning to end, when Trostler answers a handful of audience questions. (Registration required). Here are some of the key points from the recording:
- What is testability?
- It all boils down to writing and syncing interfaces, not implementation
- All dependencies should be injected into your object’s constructor
- Cross-cutting concerns or what about the crap I might need? Logging, auditing, security, caching, and more
- Quick detour on the mixin method
- Profile interface and implementation
- Runtime/short-lived dependencies with an example of picking matches on a dating website
- Mocking abstract factories