How to use new unit testing tools & techniques to improve software quality
When are unit test tools justifiable?Again, it comes down to cost. The later a defect is found in the product development, the more costly it is to fix (Figure 1 below) — a concept first established in 1975 with the publication of Brooks' "Mythical Man Month" and proven many times since through various studies.
![]() |
| Figure 1: The later a defect is identified, the higher the cost of rectifying it. |
The automation of any process changes the dynamic of commercial justification. This is especially true of test tools since they make earlier unit test much more feasible. Consequently, modern unit test almost implies the use of such a tool unless only a handful of procedures are involved.
The primary function of such unit test tools is to automatically generate the harness code which provides the main and associated calling functions or procedures (generically "procedures"). These facilitate compilation and allow unit testing to take place.
The tools not only provide the harness itself, but also statically analyze the source code to provide the details of each input and output parameter or global variable in any easily understood form. Where unit testing is performed on an isolated snippet of code, stubbing of called procedures can be an important aspect of unit testing. This can also be automated to further enhance the efficiency of the approach.
This automation makes the assignment of values to the procedure under test a simple process, and one which demands little knowledge of the code on the part of the test tool operator.
This creates that necessary unit test objectivity because it divorces the test process from that of code development where circumstances require it, and from a pragmatic perspective substantially lowers the level of skill required to develop unit tests.
It is this ease of use which means that unit test can now be considered viable for development since each procedure can be tested at the time of writing. . When these early unit tests identify weak code, it can be corrected whilst the original intent remains very fresh in the mind of the developer.



Loading comments... Write a comment