Test Pyramid and Mocking Trade-offs

[Best of 2023] #139 - A Developer's Guide to Effective Software Testing - Mauricio Aniche

Topic 3 of 4

Published Jan 15, 2024 · Clip 8:52–13:51 (4:59)

The discussion covers the test pyramid and the unit vs. integration testing debate. The guest praises the pyramid's pragmatism—unit tests at the bottom because they are cheap, fast, and robust—and highlights the 'Software Engineering at Google' perspective of splitting suites into fast (pre-merge) and slow tests. On mocking, he argues you should mock only what you don't control (e.g., external web services), not databases, and that integration tests should be reserved for finding integration bugs.