Unit Testing Done Right (Jakub Pilimon)

"Learn how to do unit testing effectively, exploring the pitfalls of TDD, the importance of test isolation, and tips for writing fast and efficient tests that actually cover your code."

Key takeaways
  • TDD leads to a waterfall process, not an iterative one.
  • Test isolation is key, but people often disagree on this.
  • Some people see testing as a form of intrusion, competing with other priorities.
  • TDD doesn’t always lead to good design, and sometimes it’s necessary to refactor.
  • Tests should be fast, covering at least 50% of the code.
  • Automated testing is more important than code coverage.
  • Tests should be written before production code.
  • Manual testing can be time-consuming and expensive.
  • Code complexity should be measured by metrics like lines of code.
  • Code should be modular and organized.
  • Code reviews can be useful, but should be automated whenever possible.
  • Dependency injection is important for maintainability.
  • Single responsibility principle should be followed in code.
  • Tests can be used to provoke thinking about the code, encouraging good design.