You can't fix
what you don't measure.
Testing produces two kinds of output: bugs, and numbers about the bugs. This chapter is about the numbers — the base and calculated metrics that turn "I think testing went okay" into "87% requirement coverage, 4.2% critical defect rate" — and the tools that collect, generate, and report those numbers so nobody has to do it by hand.
What is a test metric, and why bother?
Get the vocabulary locked in first — everything else in this chapter builds on it.
Software testing metrics (a.k.a. software test measurement) are the quantitative indication of extent, capacity, dimension, amount, or size of some attribute of a process or product — e.g. the total number of defects. The goal: improve the efficiency and effectiveness of the testing process, and support better decisions with reliable data.
Without measurement it's impossible to tell whether a process is improving. Metrics help you decide the next phase of activities, understand what kind of improvement is needed, and decide on process or technology change.
Three types of testing metrics
process · product · projectProcess Metrics
Used to improve the process efficiency of the SDLC (Software Development Life Cycle).
Product Metrics
Deals with the quality of the software product itself.
Project Metrics
Measures the efficiency of a project team, or of any testing tools the team is using.
Base Metrics: the raw data everything else is built from
Manual test metrics split into two classes — get this split right before the formulas, because every "calculated metric" later is just base metrics plugged into a ratio.
Raw, collected counts
Gathered directly during testing — nobody has computed anything yet. A great starting point that later gets used to produce calculated metrics.
Ratios and percentages, computed from base metrics
What test managers actually report upward: coverage %, effectiveness %, pass/fail %, and more — every one of them is arithmetic on the base metrics to the left.
The 12 Major Base Metrics
raw counts| # | Base Metric | # | Base Metric |
|---|---|---|---|
| 1 | Total number of test cases | 7 | Number of defects rejected |
| 2 | Number of test cases passed | 8 | Number of defects deferred |
| 3 | Number of test cases failed | 9 | Number of critical defects |
| 4 | Number of test cases blocked | 10 | Number of planned test hours |
| 5 | Number of defects found | 11 | Number of actual test hours |
| 6 | Number of defects accepted | 12 | Number of bugs found after shipping |
Five formula families — and what each one is really asking
Every calculated metric answers one plain-English question. Learn the question first; the formula follows naturally.
1 · Test Coverage Metrics — "How much of the application was tested?"
2 · Test Effectiveness Metrics — "How good were the tests? Are we running high-value test cases?"
3 · Test Effort Metrics — "How long, how many, how much?"
Great for establishing baselines for future test planning.
4 · Test Tracking & Quality Metrics — "What does the application's quality look like?"
5 · Test Efficiency Metrics — "How efficient is repairing defects?"
Two extra angles: code coverage, and overall product quality
Test Coverage Metrics (expanded)
how much of the code / featuresCall-pair coverage (% of call pairs hit): an interface whereby one module invokes another. A goal of 100% is a practical value.
The percentage of requirements that are covered by at least one test.
Quality Metrics
defect removal & detection[Bugs fixed prior to release / Known bugs prior to release] × 100
Used to help decide on process improvements, additional regression testing, and the ultimate release of the software.
[Unique defects we find / (Unique defects we find + Unique defects reported by customers)] × 100
Used to help decide on release of the final product, and how closely your testing resembles actual customer use.
Six families of tool support for testing
A test tool can be used for one or more activities that support testing: used directly in testing, used to manage the testing process, used in exploration, or "any tool that aids in testing."
🗂️ Management
- Test
- Requirement
- Incident
- Configuration
📝 Test specification
- Test design
- Test data preparation
⚡ Performance & monitoring
- Dynamic analysis
- Monitoring
- Performance / load / stress
🎯 Specific application areas
- Localization, security, usability…
- Tools tied to a needs area
▶️ Execution & logging
- Execution
- Unit testing
- Comparators
- Coverage
- Security
🔍 Static testing
- Review
- Static analysis
- Modelling
Managing the testing process itself
Management of testing & tests
traceability · reporting · metricsCharacteristics: support for managing tests and testing activities; support for traceability of tests, test results, and incidents back to source documents like requirements specifications; generation of progress reports; logging test results (monitoring); offering info on metrics related to the tests.
Improving the work product without executing it
Review, Static Analysis & Modeling Tools
code untouched, quality upStatic testing tools aid in improving the code or work product without executing it. Three categories: Review Process Tools, Static Analysis Tools, Modeling Tools.
A common reference for review processes, keeping track of all information from the review, storing/communicating review comments, and monitoring review status (passed / passed with corrections / requires re-review). Best suited to formal review processes and geographically dispersed teams.
Static analysis tools (D)Mostly used by developers for
component (unit) testing — the tool is executed, the code under review is not. Source
code is input data. An extension of compiler technology:
Source Code → Code Transition → Transformed Code → Code Analysis → Results.
Purpose: better understand the code and find ways to improve it. Common features:
calculate metrics (complexity, nesting levels → identify risk areas), enforce coding
standards, analyze code structures and dependencies.
SourceMonitor — collects metrics from source code files; displays and prints them in tables and charts (including Kiviat diagrams).
JDepend — generates design-quality metrics for each Java package; measures design quality in terms of extensibility, reusability, and maintainability.
Validate models of the system/software to better aid design: identify inconsistencies and defects within models, identify and prioritize risk areas, predict system response and behavior under various situations. Example: StarUML — a UML tool covering Class/Domain, Use Case, and Sequence diagrams.
Generating the inputs — and the tests themselves
Design, Model-Based & Data-Prep Tools
TDD · ATDD · BDDGenerate test input values from requirements, test conditions, design models (state, data, or object), code, or graphical user interfaces — and generate expected results too, if an oracle is available to the tool.
Model-based testingGenerates test input values or test cases from stored information describing a model of the system, e.g. a state transition model.
Test data preparation toolsGenerate an extensive range or volume of data when needed, and manipulate databases or files to set up test data used during test execution.
Given <some condition>, When <something is done>, Then <result should happen>
As a <role, e.g. customer>
In order to <achieve something, e.g. product>
I want <do something>
Running the tests, and proving the result was checked
Execution, Coverage, Harnesses & Comparators
drivers · stubs · comparatorsEnable tests to be executed automatically using stored inputs and expected results.
Coverage toolsIdentify coverage items (instrumenting the code), calculate the % of coverage items exercised by a test suite, report items not yet exercised, identify test inputs to exercise as-yet-uncovered items, and generate stubs and drivers if part of a unit test framework.
Test comparatorsUsed when an executed test generates a lot of output — testing is more than providing inputs, you also need to check the software produces the correct result by comparing actual outcomes to expected results. Two ways to compare: dynamic comparison (done during test execution) vs. post-execution comparison (performed after the test finished, when the software under test is no longer running).
Similar to each other — both support testing individual components/units. Both: supply inputs to the software being tested, receive outputs generated by it, execute a set of tests, record pass/fail results, store tests, measure coverage at code level, and support debugging. A harness uses stubs and drivers (small programs that interact with the software); unit test framework tools add support for object-oriented software. Used during test execution and logging.
Stub: called from the component being tested — "a component the Tested Unit depends on." A partial implementation, returning fake values.
Watching the system under realistic load
Load Data, Monitoring & Dynamic Analysis
real · load · maintenanceLoad: large amounts of test data can be produced.
Maintenance: test data from the production environment.
Tests should reflect realistic scenarios — systems are often required to handle significant load and interactions, and inadequate/insufficient testing compromises system quality. Setting up this test data is significant effort (extensive range/volume needed, resource consuming to create), which is exactly what test data preparation tools help manage.
Identify problems and send an alert message to the administrator (e.g. network administrator): logging real-time and historical information, finding optimal settings, monitoring the number of users on a network, monitoring network traffic (real time, or over a period with analysis done afterward). Example: Windows Performance Monitor.
Dynamic analysis tools (D)Features/characteristics include support for detecting memory leaks, identifying pointer arithmetic errors such as null pointers, and identifying time dependencies. Example: Windows Task Manager (process/memory/CPU inspection).
Tools built for one job, and "hidden" testing tools
Niche tools & the tools that don't look like testing tools
specializedTesters may use a word processor or spreadsheet as a testing tool — often to store test designs, test scripts, and test data. Testers may also use SQL to set up and query databases containing test data. Tools developers use for debugging — to localize defects and check fixes — are also testing tools. It's worth looking at any tool available to you for ways it could support testing activities.
Tools are not magic
Simply purchasing or leasing a tool does not guarantee success with it — each type of tool requires additional effort to achieve real, lasting benefit.
Greater consistency & repeatability — people do the same task a little differently each time (distractions, multitasking, interruptions, fatigue, external pressure); a tool reproduces the exact same procedure every time.
Objective assessment — humans are prone to error and subjective, preconceived bias toward verification; tools give repeatable, consistently calculated results (cyclomatic complexity, nesting levels, coverage, system behavior, incident statistics).
Ease of access to information — charts and graphs are easier for the human mind to parse than a long list of numbers; special-purpose tools provide statistics, incident rates, and performance data directly.
Underestimating the time, cost, and effort to introduce a tool (training, external expertise).
Underestimating the time/effort needed to achieve significant, continuing benefit.
Underestimating the effort required to maintain the test assets the tool generates.
Over-reliance on the tool — replacing testing where manual testing would actually be better.
Special considerations by tool type
Test execution tools
Capture/replay (recording a manual tester) seems attractive but doesn't scale and can be unstable. Data-driven: separates test inputs from a generic script. Keyword-driven: a spreadsheet holds keywords/action words plus test data; testers define tests using the keywords.
Performance testing tools
Requires care around the design of the load to be generated, timing aspects / the probe effect, and how to interpret the gathered information. Needs a tester with performance testing expertise.
Static analysis tools
Risk that changes made to conform old code to a new standard introduce unexpected side effects; applying the tool to existing code may generate many messages. A gradual rollout with initial filters is more effective.
Test management tools
Need to interface with other tools or spreadsheets, to produce information in the best format for the organization's current needs.
Interview-question territory
These definitions get asked constantly in interviews and on exams — precise wording matters.
| Term | What it is |
|---|---|
| Quality Assurance (QA) | The planned, systematic way of monitoring the quality of the process used to produce a quality product. QA tracks outcomes and adjusts the process. QA is not just testing. |
| Quality Control (QC) | Concerned with the quality of the product. Finds defects and suggests improvements. The process QA sets is implemented by QC — QC is the tester's responsibility. |
| Software Testing | The process of ensuring a developed product meets user requirements — the motive is to find bugs and get them fixed. |
Validation: evaluating the software during or at the end of development to determine whether it meets the specified requirements.
Decision coverage: testing that ensures every decision-taking statement is executed at least once.
Both exist so the tester knows no branch or decision statement will lead to failure.
Branch Coverage = Tested Decision Outcomes / Total Decision Outcomes
A collection of algorithms and techniques used to analyze source code in order to automatically find bugs — similar in spirit to compiler warnings, but taken further to find bugs traditionally found via run-time debugging/testing. Static analysis bug-finding tools have evolved from basic syntactic checkers to tools that find deep bugs by reasoning about the semantics of the code.
Defect Costs
rises exponentially by phaseThe cost of fixing a defect rises exponentially by lifecycle phase — a defect caught in requirements is far cheaper to fix than the same defect caught after release.
Testing types: Black-box, White-box.
Static vs. Dynamic Testing.
Automated Testing: has pros and cons.
Integration, 2 types: Top-down, Bottom-up.
Software Quality Assurance (SQA): an ongoing process within the SDLC that routinely checks developed software meets desired quality measures. Breaks down into: quality of planning, formal technical reviews, testing, and training.
What it means to be a professional tester
ACM & IEEE Code of Ethics for Software Engineers
8 principles| 1 | PUBLIC — Software testers shall act consistently with the public interest. |
| 2 | CLIENT AND EMPLOYER — shall act in a manner that is in the best interests of their client and employer, consistent with the public interest. |
| 3 | PRODUCT — shall ensure that the deliverables they provide (on the products/systems they test) meet the highest professional standards possible. |
| 4 | JUDGMENT — shall maintain integrity and independence in their professional judgment. |
| 5 | MANAGEMENT — test managers and leaders shall subscribe to and promote an ethical approach to the management of software testing. |
| 6 | PROFESSION — shall advance the integrity and reputation of the profession, consistent with the public interest. |
| 7 | COLLEAGUES — shall be fair to and supportive of colleagues, and promote cooperation with software developers. |
| 8 | SELF — shall participate in lifelong learning regarding the practice of their profession, and shall promote an ethical approach to the practice of the profession. |
Where students actually lose marks
Every one of these is a real confusion this chapter sets up on purpose — drill them until the "wrong" option stops sounding reasonable.
Test Effectiveness vs. Test Efficiency
Base Metrics vs. Calculated Metrics
QA vs. QC vs. Testing
Branch Coverage vs. Decision Coverage
Driver vs. Stub
Verification vs. Validation
Static Analysis Tools vs. Dynamic Analysis Tools
Segment Coverage Goal vs. Call-Pair Coverage Goal
The whole chapter, one scannable grid
| Category | Answers the question | Key formula / fact |
|---|---|---|
| Test Execution Coverage | How much did we run? | Tests run / Tests to be run × 100 |
| Requirements Coverage | How much did we cover? | Requirements covered / Total requirements × 100 |
| Test Effectiveness | How good were the tests? | Bugs found in test / Total bugs found × 100 |
| Test Effort — tests/time | How fast are we running tests? | Tests run / Total time |
| Test Effort — bug find rate | How fast are we finding bugs? | Total defects / Total test hours |
| Test Effort — bugs per test | How buggy is each test? | Total defects / Total tests |
| Test Effort — avg fix-retest time | How long to verify a fix? | Total fix-to-retest time / Total defects |
| Passed / Failed Test Cases % | What's overall quality? | Passed (or Failed) / Total executed × 100 |
| Critical Defects % | How severe are the bugs? | Critical defects / Total defects reported × 100 |
| Fixed Defects % | How efficient is fixing? | Defects fixed / Defects reported × 100 |
| Test Efficiency | How fast do we repair? | Total repair time / Number of bugs |
| Defect Removal % | What % of known bugs got fixed? | Bugs fixed prior to release / Known bugs prior to release × 100 |
| Defect Detection Efficiency | Did we catch bugs before customers did? | Unique defects we find / (we find + customers report) × 100 |
| Segment Coverage | Code coverage (unit/integration) | Practical goal: 85% |
| Call-Pair Coverage | Interfaces between modules covered | Practical goal: 100% |
| Branch Coverage | Every branch executed? | Tested decision outcomes / Total decision outcomes |
| Management tools | Traceability, reporting, metrics | Test/ALM, requirements, defect, config mgmt, CI |
| Static testing tools | Improve code without running it | Review, static analysis (D), modeling (D) |
| Design & spec tools | Generate inputs / tests | Test design, model-based, data prep, TDD, ATDD/BDD |
| Execution & logging tools | Run tests, log results | Execution, coverage, harness/framework, comparators |
| Performance & monitoring | Load testing, watch the system | Test data (real/load/maintenance), monitoring, dynamic analysis (D) |
| QA | Process quality, not just testing | Planned, systematic; popularized WWII |
| QC | Product quality, finds defects | Tester's responsibility |
Click a question to reveal the answer
No page reload — just click to check yourself.
Worked, exam-style problems
Same shape as the calculations this chapter's slides worked through — drill these until the arithmetic and the interpretation are both automatic.