Loading

Defect Density


The purpose behind software testing is to bring to forefront all such errors that can cause malfunction. Today competition is so high that every company wants to have a perfect final product. In order to validate the functioning of the program, it has to go through rigorous rounds of testing. The defects found during testing are then removed so as to make the final launch product near perfect. Through this article, we shall try and impart to you more knowledge about Defect Density.

What Is Defect Density?

Defect Density in any software or program can be defined as the ratio of total number of defects that have been confirmed to the size of the program. In metric terms, it is defined as the ratio of total defects to the total number of line codes. One thing that needs to be clearly understood is that, here, defects refer to all those errors that have been confirmed and not just reported. So any defect that has been reported but not validated or agreed upon will not be counted.

Formula For Defect Density

The mathematical formula for calculating Defect density is:

Defect Density = Number of Defects / Size of the Software

Here, the size of the project can be measured in terms of feature points or function points.

Many times Defect Density is also calculated per thousand lines of written code. This is also known as KLOC, where "K" stands for "thousand" and LOC is the "Lines of Code".

Why Is Defect Density Calculated?

Defect density is usually calculated to serve one of the two below mentioned purposes:

  • Identifying High Risk Component – calculation of Defect Density makes it possible to identify that particular component that is liable to more errors. This way more time and resources can be diverted towards its correction.
  • Comparison Of Softwares – when quality of two similar softwares needs to be tested, it can be best achieved through the Defect Density calculation. Obviously, a product that has a higher Defect Density will be poorer in quality and vice-versa.

Benefits Of Calculating Defect Density

The prime advantages of calculating Defect Density are:

  • It is helpful in identifying those areas that are prone to more errors and hence can be categorized as high-risk.
  • It aids in recognizing all defective areas and helps prioritize the correction work.
  • It readily advises if the testing conducted so far is sufficient or not. This way it is possible to know the outcome before launching the final program.
  • Many times Defect Density is really handy in identifying the training needs of the given resources.

Factors Affecting Defect Density

Those factors that can affect the Defect Density are:

  • Complexity Of Code – the more complex a code, the higher are the chances of increase in the number of defects. Therefore, it can be said that the code complexity is directly proportional to the Defect Density.
  • Skills Of Tester – the more skilled a tester, the higher are the chances of them finding even the most minute errors that can cause trouble later.

Conclusion

There is no fixed standard for calculating Defect Density. One standard might be suitable to a particular type of software but it might not serve the purpose in another. The popular belief is that KLOC method is the most advisable.