🚀 Integrated Tests Are A Scam (J.B. Rainsberger)

Discover the pitfalls of integrated tests and learn how to write effective tests with collaboration, contract, and isolation techniques to ensure a secure and maintainable system.

Key takeaways
  • Integrated tests can be a scam because they can lead to a false sense of security, making developers rely too heavily on them and neglecting other testing strategies.
  • Collaboration tests are a more effective way to test and should be used as the primary testing strategy, as they check if an implementation matches its interface.
  • Contract tests are necessary to ensure that an implementation correctly implements a given interface or protocol.
  • Integrated tests can make it difficult to isolate and debug issues, as they are often complex and test multiple components at once.
  • The concept of the “tree” (a decomposition of the system into smaller components) can help simplify testing and development.
  • Stubbing out dependencies and using interfaces can help reduce the complexity of testing and make it more manageable.
  • Test-driven development (TDD) and behavior-driven development (BDD) can help improve the quality of tests and the design of the system.
  • Relying too heavily on integrated tests can lead to tight coupling and technical debt, making it difficult to change the system in the future.
  • It is important to write small, focused tests that test specific behavior, rather than complex, comprehensive tests that try to cover everything at once.