Friday, September 9, 2016

Adding Testing to Untested Project

If your project is currently untested, you should start adding tests. Here’s how to do it in three steps:

  1. Put your code in a repository (git or subversion, for example).
  2. Install Jenkins or some other continuous integration server.
  3. Write your first test.

Making it Work

The most important factor in making testing work is that the management and senior developers have to make the commitment to only allow tested code to enter the code base. All new code changes must come with testing to support them.

If a programmer is assigned to add a feature to the code, then he or she must also develop tests for that feature. The development of the test code must be considered an integral part of the task. It is not an afterthought - it is central.

Only by submitting test code with the code changes can the programmer demonstrate the correctness of the proposed changes. The programming culture must change so that it is no longer acceptable to merge work based on just the programmer’s say-so. Work must be demonstrated to be correct - demonstrated like a mathematical proof.

Incrementalism

A key to a successful strategy is incrementalism.

A large software package has a lot of code to test. It may take months or years to fully test a complex package. It may never be fully tested.

But it is possible to add some tests, for some commonly-used functionality, today. And, over time, you will find that it is possible to quickly spin up a useful set of tests. Over time, they will improve.

No comments:

Post a Comment