
264
Chapter 17 Project Smells
Cause: Hard-to-Test Code
A common cause of Developers Not Writing Tests, especially with “legacy soft-
ware” (i.e., any software that doesn’t have a complete suite of automated tests), is
that the design of the software is not conducive to automated testing. This situa-
tion is described in more detail in its own smell, Hard-to-Test Code (page 209).
Cause: Wrong Test Automation Strategy
Another cause of Developers Not Writing Tests may be a test environment
or test automation strategy that leads to Fragile Tests (page 239) or Obscure
Tests (page 186) that take too long to write. We need to ask the “fi ve why’s”
[TPS] to fi nd the root causes. Then we can address those causes and get the ship
back on course.
Troubleshooting Advice
Project-level smells such as Developers Not Writing Tests are more likely to be
detected by a project manager, scrum master, or team leader than by a developer.
As managers, we may not know how to fi x the problem, but our awareness
and recognition of it is what matters. This unique perspective allows managers
to ask the development team questions about why they aren’t writing tests, in
which circumstances, and how long it takes to write tests when they do so. Then
managers can encourage and empower the developers to come up with ways of
addressing the root causes so that they write all the necessary tests.
Of course, managers must give the developers their full support in carrying
out whatever improvement plan they come up with. That support must include
enough time to learn the requisite skills and build or set up the necessary test
infrastructure. And managers shouldn’t expect things to turn around overnight.
They might set a process improvement goal for each iteration, such as “20%
reduction in code not tested” or “20% improvement in code coverage.” These
goals should be reasonable and at a high-enough level that they encourage the
right behavior, as opposed to just making the numbers look good. (A goal of 205
more tests written, for example, could be achieved without increasing the test
coverage one iota simply by splitting tests into smaller pieces or cloning tests.)
Developers
Not Writing
Tests