What is Defect Density? Formula to calculate with Example

What is Defect Density?

Defect Density is the number of defects confirmed in software/module during a specific period of operation or development divided by the size of the software/module. It enables one to decide if a piece of software is ready to be released.

Defect density is counted per thousand lines of code also known as KLOC.

How to calculate Defect Density

A formula to measure Defect Density:

Defect Density = Defect count/size of the release

Size of release can be measured in terms of a line of code (LoC).

Defect Density Example

Suppose, you have 3 modules integrated into your software product. Each module has the following number of bugs discovered-

Total bugs = 10+20+10 =40

The total line of code for each module is

Total Line of Code = 1000+1500+500 = 3000

Defect Density is calculated as:

Defect Density = 40/3000 = 0.013333 defects/loc = 13.333 defects/Kloc

A standard for defect density

However, there is no fixed standard for bug density, studies suggest that one Defect per thousand lines of code is generally considered as a sign of good project quality.

Factors that affect the defect density metrics

Advantages of defect density

 

YOU MIGHT LIKE: