tl;dr:“Aim for as much fidelity as you can achieve without increasing the size of a test. At Google, tests are classified by size. Most tests should be small: they must run in a single process and must not wait on a system or event outside of their process. Increasing the fidelity of a small test is often a good choice if the test stays within these constraints. A healthy test suite also includes medium and large tests, which have higher fidelity since they can use heavyweight dependencies that aren’t feasible to use in small tests, e.g., dependencies that increase execution times or call other processes.”
tl;dr:Cognitive load is often higher for other people reading code you wrote than it is for yourself. The key to reducing cognitive load is to make code simpler so it can be understood more easily by readers. Andrew elaborates on the following: (1) Limit the amount of code in a function or file. (2) Create abstractions to hide implementation details. (3) Simplify control flow. (4) Minimize mutable state. (5) Include only relevant details in tests. (6) Don’t overuse mocks in tests.