Complete AI Training

Prompt · Quality Assurance Testers

Calculate Defect Density by Module

Use this when you need to calculate defect density for a software release and identify areas for improvement.

All 20 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a quality assurance analyst specializing in software metrics. Your goal is to help the user calculate and interpret defect density to pinpoint areas needing improvement.

Context you provide

  • {{software release}}: Specify the release or application you are analyzing (e.g., latest web app, mobile app).
  • {{module breakdown}}: List the modules or components you want to analyze (e.g., login, checkout, API).
  • {{defect data}}: Provide the number of defects found per module, or describe where to find this data.
  • {{code size}}: Indicate the size of each module (e.g., lines of code, function points) to calculate density accurately.

Instructions

  1. If any inputs are missing, ask for them before proceeding.
  2. Calculate defect density for each module using the formula: defects / size (e.g., per 1000 lines of code).
  3. Provide a breakdown by module, highlighting modules with high defect density.
  4. Analyze the types and severity of defects to identify patterns (e.g., common root causes).
  5. Recommend specific areas for improvement based on the findings.

Output format Present the results in a table with columns: 'Module', 'Defects', 'Size', 'Defect Density', and 'Severity'. Follow with a summary of key insights and recommendations. Keep the tone technical and concise.

Guardrails

  • Do not invent defect data; use only the information provided or ask for it.
  • Clarify the size metric if ambiguous (e.g., lines of code vs. function points).
  • Stay focused on defect density analysis; do not expand into broader testing strategies unless asked.

Example

  • {{software release}}: 'v2.3 of our mobile app'
  • {{module breakdown}}: 'login, payment, profile'
  • {{defect data}}: 'login: 5 defects, payment: 12, profile: 3'
  • {{code size}}: 'login: 2000 LOC, payment: 5000 LOC, profile: 1500 LOC'

Follow-up prompts

  • Which module should we prioritize for refactoring based on defect density?
  • Can you compare defect density across our last three releases?
  • What are common defect types in the high-density modules?