Texas Sharpshooters and Test-Driven DevelopmentCover image taken from an illustration by Dirk-Jan Hoek I recently learned about a logical fallacy called The Texas Sharpshooter fallacy. The first thought that crossed my mind when I first read about it was, "What does Texas have to do with any of t...Feb 9, 2024 · 4 min readdavidadamojr.hashnode.dev
Avoid Fakers in Unit TestsIn your unit and integration tests, avoid using tools that automatically generate test input data. Unless you are fuzz testing or your goal is to create property-based tests, these test data generators (a.k.a. fakers) are likely to do more harm than ...Feb 8, 2024 · 1 min readdavidadamojr.hashnode.dev
Duplication over Abstraction in Unit TestsOne of the first things you learn as a software engineer is to avoid code duplication whenever possible. But this same learned aversion to duplication is what causes many software engineers to fill their unit tests with logic and abstractions that ca...Feb 26, 2023 · 1 min readdavidadamojr.hashnode.dev
What does bad code look like?What does bad code look like? Code that does not do what it should is probably bad by default. Not much else to say about this one. Beyond that, it is probably easier to think of bad code in terms of what it feels like. Most of the bad code I've seen...Jan 30, 2023 · 2 min readdavidadamojr.hashnode.dev
Are your Tests Necessary and Useful?Some automated tests are unnecessary or problematic. For each automated test you write, ask yourself: Does this test offer any additional test coverage that is not already addressed by some other existing test? Which defect(s) do I expect this tes...May 22, 2022 · 1 min readdavidadamojr.hashnode.dev