The Beer Belly testing anti-pattern

The ‘Testing Pyramid’ is often trotted out to illustrate a suggested distribution of tests. More small “unit” tests; less deep “end-to-end” tests. And various people have observed common anti-patterns, specifically the Ice Cream Cone, where there are lots of end-2-end tests and hardly any unit tests.

Beer Belly testing


The anti-pattern that I see most often is the Beer Belly. This stems from a misunderstanding of what constitutes a unit test. It’s proven difficult to define exactly what a unit test is, but Mike Feathers described what ISN’T a unit test – notably tests that hit the network, the file system or the database. Most developers don’t seem to have taken this on board and write many tests that rely on some (or all) of these external components.

Combine this tendency to write integration tests instead of unit tests with a whole pile of manual test scripts and you get the classic beer belly topped with a big, cloudy head of woe.

And you know the best way to cure a hangover. Hair of the dog, anyone?





Leave a Reply

Your email address will not be published. Required fields are marked *