DEV Community

Discussion on: Is testability a reason to change your design?

Collapse
 
shiling profile image
Shi Ling • Edited

Don't test for the sake of 100% code coverage.

Not everything is worth the time or effort to test.

For example, IMHO, CRUD operations aren't quite worth the effort, because they are straightforward enough that fellow engineer can easily spot a mistake during a code review, and also because they will be used often enough in various parts of the application that mistakes would be obvious and emerge very quickly.

I automate tests (and refactor for testability) when the logic is complex enough that mistakes would be difficult to spot during code reviews, for example where there are computations and decision trees.