chapter seven
This chapter covers
- How to make your code more testable, at architectural, design, and implementation levels
- The hexagonal architecture, dependency inversion and injection, observability and controllability
- What hinders the testability of your code and how to avoid such pitfalls
I usually say that every software system can be tested; however, some are more testable than others. Some software systems can be indeed very hard to be tested. Imagine that, for a single test case, the developer needs to set up three different web services, create five different files in different folders of the system, and put the database to a specific state. After all that, the developer exercises the feature under test and, to assert the correct behavior, the developer needs again to see if the three web services were invoked, that the five files were consumed correctly, and that the database is now on a different state. All those steps are totally doable; however, I ask: Could this not be simpler?