Guide
What is test impact analysis?
By the CoverOps team · Last updated
Short answer
Test impact analysis (TIA) records which code each test executes, and when the code changes it uses that record to find the tests that exercise the changed code. Its output is a list of affected tests; whether you then run only those is a separate decision, called test selection.
How it works
- Record a footprint per test. While each test runs, coverage instrumentation records which lines or methods it executed. This is the test's footprint.
- Find what changed. The version-control diff for a commit, pull request or time window gives the changed files and lines.
- Intersect. A test is affected when its footprint contains changed code. The result is the list of affected tests, and the changed code that no test's footprint contains.
The approach is old and well documented. Paul Hammant's article on martinfowler.com traces it through several companies, and Microsoft documents a TIA option for .NET tests in Azure Pipelines. Some very large codebases select tests from build dependencies between code and tests rather than from per-test coverage; Memon and colleagues describe Google's continuous testing in those terms.
Impact analysis versus test selection
These are often used as synonyms, and they are not the same claim. Impact analysis says what a change affects and which tests exercised it. Test selection decides to run only those tests. You can use the first without the second: a reviewer who sees that a change touched code no test reaches has learned something, even if the full suite runs anyway.
What it needs to be trustworthy
- Recent footprints. A footprint is a snapshot of the last run. If code paths changed since, the footprint is stale, so the full suite should still run regularly.
- Coverage where the tests reach. For end-to-end and API tests, that means the deployed services, not only the unit under test. Unit-test coverage alone cannot map a UI test to backend code.
- A rule for unknown tests. A new test has no footprint, so it can never be selected on evidence. It must run until it has one.
Where it falls short
- Changes outside instrumented code: configuration, database schema, feature flags, infrastructure.
- Behaviour that depends on data or timing, where a test reaches different code on different runs.
- Services without instrumentation, which simply do not appear in any footprint.
- Indirect effects: a change that alters a value used elsewhere without that other code changing.
For these, the safe default is the full suite. Impact analysis narrows the question; it does not remove the need to run everything sometimes.
How CoverOps does it
CoverOps records footprints with agents on the running services (Java, .NET, Node.js, Python, Go and PHP each record the lines each test executed). It matches commits from GitHub, GitLab, Bitbucket or Azure DevOps repositories against them, shows the affected tests and the changed lines nothing reached, and returns a list for CI through its CLI. It does not run or schedule the tests itself.