4.6. Split logic
Nobody likes to read tests that span several screenfuls of code. Part of the reason is because such tests almost invariably exhibit more than a couple of test smells, and you’re probably not certain what the test is doing and whether that’s what it’s supposed to do. Another reason to not like long methods that span several screenfuls is that it means you’re forced to switch context, going back and forth between different parts of the source file to keep track of where you are and what’s going on.
In short, the code you’re looking for is scattered and requires extra effort, adding to your already significant cognitive load.[6]
6 Cognitive overload is an especially common problem for programmers, due to programming being intrinsically ...
Get Effective Unit Testing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.