Growth Chart
This metric tracks the rate of test growth code compared to source code growth.
Main Description

Overview

This metric indicates how the test code is growing compared with the source code during the development lifecycle.  Test code should grow at roughly the same rate as system code if developers are testing their code before integrating it with other code.This allows developers to observe the relationship between the size of test code and source code over time.

Definition

Count: Test Growth (TGi) = Total source lines of test code at time i 
           System Growth (SGi) = Total source lines of code at time i
           New and Changed Test Code (NCTi) = Total new and changed source lines of test code at time i. Count only the number of added and changed lines of test code.
           New and Changed Source Code (NCSi) = Total new and changed source lines of code at time i relative to time i-1.  Count only the number of added and changed lines of code.

Analysis

The growth of test and source code should usually show similar patterns over time.  If developers are testing early and often, the growth of both test code and source code should be increasing at roughly the same rate.  Also, the ratio of new and changed source code to new and changed test code should remain roughly the same over time.  Figure 1 and Figure 2 show examples of a growth chart and a new and changed code chart for a project.

Beware if the pattern of growth changes during the development lifecycle.  For example, if system growth starts growing at a much faster or slower rate than tests, then this can indicate that the team is not doing sufficient testing if you want to follow a strategy of constant testing. 


 Growth Chart
Figure 1: Growth Chart: Source Lines of Code by Iteration (triangles = source code, squares = test code)


New and Change code
Figure 2: New and Change Code Chart: Source Lines of Code by Iteration (triangles = source code, squares = test code) 

Metric Pitfalls

  • If the source code is not growing as fast as test code, it may be due to refactoring. New and changed code can then help you determine whether the team is testing continuously.  If the new and changed code remains relatively constant, the team is probably refactoring the code.