Chapter 6: Defect Management
Defect Lifecycle
stateDiagram-v2
[*] --> New
New --> Assigned
Assigned --> InProgress
InProgress --> Fixed
Fixed --> ReadyForTest
ReadyForTest --> Verified: Pass
ReadyForTest --> Reopened: Fail
Reopened --> Assigned
Verified --> Closed
Closed --> [*]
Writing Effective Bug Reports
Good Bug Report Template:
Title: Login fails with email >50 chars
Severity: High
Priority: P1
Steps to Reproduce:
1. Navigate to login page
2. Enter email with 51 characters
3. Enter valid password
4. Click Login
Expected: Login successful
Actual: "Invalid email" error shown
Environment:
- Browser: Chrome 118
- OS: Windows 11
Bug Severity vs Priority
| Severity | Priority | Example |
|---|---|---|
| High | High | Payment processing fails |
| High | Low | Typo in help documentation |
| Low | High | Logo misaligned (before launch) |
| Low | Low | Minor UI inconsistency |
Defect Metrics
def calculate_defect_metrics(defects):
"""Calculate key defect metrics"""
total = len(defects)
open_defects = [d for d in defects if d.status != 'Closed']
return {
'defect_density': total / lines_of_code * 1000,
'defect_removal_efficiency': (found_in_test / (found_in_test + found_in_prod)) * 100,
'open_defect_age': avg([d.age_days for d in open_defects])
}
Key Takeaways
ā Clear bug reports save time ā Track defect lifecycle ā Distinguish severity from priority ā Use metrics to improve quality
Complete Lab 6 to practice defect management!