Summary
In this chapter, we revisited the definition of testability and its related architectural quality aspects, such as complexity and determinism. We looked at the different architectural aspects that are tested and got an understanding of the type of tests that are usually performed by the software testing process.
We then discussed the various strategies for improving the testability of software, and looked at techniques to reduce system complexity and improve predictability and to control and manage external dependencies. Along the way, we learned the different ways to virtualize and manage external dependencies, such as fakes, mocks and stubs, by way of examples.
We then looked at unit testing and its various aspects mainly from the perspective of the Python unittest
module. We saw an example by using a datetime
helper class, and explained how to write effective unit tests—a simple example followed by an interesting example of patching functions using the mock library of unittest...