Software Testing - Defect Density



The process of testing results in identifying defects in the software. Both the developers and testers are equally responsible in finding defects, and ensuring that quality is not compromised. A defect becomes more and more costly if it is identified at the later stages of software development. Thus software quality is related to the defects, meaning as the count of defects increases, the software quality keeps coming down.

What is Defect Density?

The defect density is the total count of defects identified per line of code in the entire software development lifecycle. It is a mathematical number and is used to determine the quality of the software which means lower the defect density number, better is its software quality.

The defect density number guides the development team to identify the modules which have higher chances of defects. Consequently, the testers also focus more on those modules. It is normally measured as the total number of defects per 1000 lines of code(KLOC).

Defect Density = (Count of total defects)/Software Size

Thus, the mathematical formula to obtain the defect density is −

Defect Density = (Count of total defects)/Lines of code per 1000

Real Life Example of Calculating the Defect Density

Let us take an example of software which has two modules. 30 defects are detected in each modules. The module 1 is having 1000 LOC, and module 2 is 2000 LOC. The defect density calculated for the above example will be: (30+30)/(1000+ 2000) = 0.02 defects/LOC = 20 defects/KLOC.

There is no standard set for an acceptable defect density number in the industry. A higher defect density number points to the fact that the software does not have the required quality and hence not suitable for deployment to production. In such a situation, the development team revisits the software code, fixes the issues, and the testing team revalidates the software.

However, as per industry standards a defect density in the range of 0.1-0.5 Defect/LOC are considered acceptable.

Which Factors Determine the Defect Density?

The factors that determine the defect density are listed below −

  • Complexity − As the software complexity increases, the probability of identifying defects increases.
  • Skill Set − If the software is built with lesser experienced developers or with developers having unmatched skill set, there may be poor development resulting high defect density.
  • Defect Types − In the same software, the functional or UI related defects are more frequent that security or performance related defects.

Defect Density Advantages

The precise and exact defect density number gives the development confidence on the software quality, and its performance. The developers can conclude that the software they developed is ready to be shipped to customers, and do not need any additional testing. The defect density number helps both the developers and testers to measure the amount of rework that needs to be done to rectify the errors.

The defect density identifies the components of the software that are more prone to defects and hence higher testing efforts need to be made. Based on the defect density number, the testing team finds the additional resources, and training that is needed to complete testing.

A very lower defect density number denotes two things, either the developers have developed the software well or the testers do not have the adequate knowledge, hence they failed to do a thorough testing of the software.

Conclusion

This concludes our comprehensive take on the tutorial on Software Testing - Defect Density. We’ve started with describing what is defect density, a real life example of calculating the defect density, which factors determine the defect density, and defect density advantages. This equips you with in-depth knowledge of Software Testing - Defect Density. It is wise to keep practicing what you’ve learned and exploring others relevant to Software Testing to deepen your understanding and expand your horizons.

Advertisements