Defect Density in Software Testing
Defect Density is the number of confirmed defects detected in software/component during a defined period of development divided by the size of the software/component. It is a process that helps to decide if a piece of software is ready to be released.
The importance of defect density is high in Software Development Life Cycle (SDLC), as it compares the relative number of defects in various software components, which would further help in identifying the area that requires additional inspection, testing, and refactoring.
Defect Density Calculation
Defect Density = Number of defects
size of the release(source line of code)
There is no fixed standard for defect density, however, studies suggest that one Defect per thousand lines of code is generally considered as a sign of good project quality. This standard of defect density is also known as KLOC.
Factors affect the defect density metrics
- The complexity of the code: Complexity of the code affects defect ratio in software. A high complex code will have a higher defect density rate.
- Type of defects: Defect density does not consider the type of defects (like high, critical, low, and blocker) while performing the calculation. This is one of the drawbacks of the defect density calculation.
- Time duration: Defect density does not take into account the amount of time spent on testing. It only shows how many bugs are in the software for a particular area/line of code at a given time.
- The skill of developer or tester: This is one of the factors which affects the defect density. The highly skilled tester will more likely to find more bugs than a lower experienced tester. But it just reflects the number of bugs found in the software and does not look into the actual quality.
- Complex user interface: Defect density does not provide any feedback about the user experience of the software. But sometimes the usability issues are reported as “improvements” or “suggestions”, but it doesn’t get added in bug count.
Uses of Defect density
- It helps to identify the remaining defects by comparing them with the expected defect density.
- It helps to identify the areas for correction or improvement.
- It helps to determine whether the testing is sufficient or not.
- It helps in identifying high-risk components.
- It communicates the progress and quality of product to stakeholders.
- It helps in measuring the testing effectiveness.