Why don’t people Test First?

In my last blog I describe two potential silver bullets: working test first and reducing work in progress. I finished by promising to discuss why they aren’t used more. This post briefly discusses why people don’t work test first, the second one, looks at why it is hard to reduce WIP, work in progress.

It is easy to understand why people don’t work test first: we (humans) are optimistic. Test first is hard and historically test comes at the end of a process. Because testing is traditionally (almost) the last thing that happens moving testing requires change which is counter intuitive and often perceived as risky. (That risk is very really for when work is sub-contracted: there is an incentive for the supplier to delay testing to make it harder for clients to change suppliers.)

The thing we call “Testing” has several parts. The first, should, involve working out what tests to do: test writing. Later those tests are executed (manually or automatically) against the candidate solution. If the candidate does not pass there is more work to do. While the test execution cannot occur until the is a thing has been created the tests themselves can be decided in advance. This is what I call test first: decide what tests you intent to perform. Thinking about the tests up front is an act of learning and informs the work of creating the solution.

Working test first requires thinking and it requires thinking about something we would rather not happen. Since we are optimistic we see this as waste, or something that should be done by people paid less than us. So it requires discipline to do it. You need to be able to project yourself into the future and ask “What will the result look like?” Thinking test first is often better done with others, e.g. pair programming or “power of three” analysis sessions, so keep each other disciplined.

While it is relatively easy to work test first when programming the skills required to write automated test first require some time to master. This skill still isn’t taught at most schools or colleges so people need to learn it later in their career. Since people are optimistic, they often lack the motivation to learn to write tests first so they never master the skills. Since they are always on the learning curve test first coding takes longer and they often give up before they master it. If they stay the course, if they master the skills then they will find that while coding may still take longer the elapsed time is less because they no longer need to fix things afterwards (“debug later”.)

(As an aside, I’ve long been of the opinion that when we get AI technology to write programs (which is now starting to happen) writing tests will become more important than code. While machines will write more code which executes and doesn’t crash there is still a need to test the code does what is wanted. If we have a good test set then machines can be left to iterate and mutate code until it passes the tests.)

Outside of code the testing skillset is less well defined and people are less accustomed to thinking about tests anyway. Consequently working test first is more difficult. Add to that the fact that there are many more parameters to consider, and people are more forgiving than machines and it become more difficult still.

So, while test first working might be a silver bullet it is not easy to adopt. But then, because it is hard to do it is also hard for your competitors to do which means test first can be the source of competitive advantage.

Next Why is it hard to reduce WIP?


Enjoyed this post? Subscribe for updates and download Continuous Digital for free

Why don’t people Test First? Read More »