Defect Density and Its Use

Why Defect Density

If you want to:

  • take decision whether a product is ready for release/shipping.
  • predict the count of remaining bugs.
  • estimate the testing and rework due to bugs
  • identify the areas having more bugs
  • determine if the enough testing is done

Defect Density and Formula:

Defect Density is the calculated by dividing the Valid Bugs identified in a specific duration, by the size of the release.

The formula is simple, Defect Density= Defect Count / Size of the release

Size of the release, can be measured in terms of Line of Code (LoC), which is very popular. However, it is better to size the projects using Function Point, Use Case Point, Size of iterations/sprints etc.

It is based on the concept that if you have historical data, then you can predict the count of the bugs in a release. Then based on the difference of Expected Bug count and actual bug count, one can take decision.


This example calculates the Defect Density using KLoC

Release # Lines of Code Defect Count
Pre release
Defect Count
Post release
1.0 1,00,000 650 50 7.00
2.0 95,000 500 75 6.05
3.0 1,10,000 600 60 6.00
4.0′ 1,20,000 590 55 5.38
5.0 1,50,000 700 50 5.00
6.0 1,90,000 540 55 3.13
7.0 2,25,000 780 35 3.62
8.0 3,00,000 890 20 3.03
9.0 2,50,000 300 20 1.28

The Defect Density in above product is in range 3 to 6. Hence if we consider release 9, then you may like to spend more time on testing as the defect density is yet to go near expected density. In other words, there is still scope of finding 430 to 1180 bugs.

Once you close the testing of Release 9.0, then you will updated the above table, and it may possible that expected Defect Density dips/surges further.

Following Graph is the example, of Defect Density using size (Function/Use point).



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s