Test impact analysis: how to run the right tests faster in CI

Key takeaways
- Test impact analysis runs only the tests mapped to the code a change touches.
- Predictive test selection ranks tests by past failures instead; Meta's model caught over 99.9% of regressions while running about a third of tests.
- Keep two safety nets: an always-run set and a scheduled full regression run.
Test impact analysis exists because the two most obvious options fail at scale. Running every test on every pull request makes developers wait on results that mostly don't apply to their change, while skipping tests at random lets regressions through. Test impact analysis picks the tests a change actually touches.
The pressure is growing as coding agents raise change volume. mabl's own engineering team went from around 235 changes a month to about 300 a week. At that rate, a full suite on every PR either slows merges or gets bypassed. This guide covers how test impact analysis works, how it compares with predictive selection, and how to roll it out with safety nets.
What is test impact analysis?
Test impact analysis (TIA) is a CI technique that selects and runs only the tests affected by a code change. It relies on a map between each test and the code it exercises, then compares that map with the files in a commit or pull request to decide which tests to run.
Teams build the map in one of two ways. Dependency mapping follows the build graph: if a test target depends on a changed module, directly or indirectly, it runs. Build tools such as Bazel work this way. Coverage mapping runs each test under instrumentation and records which source files it touches, so selection follows observed behavior.
Either way, TIA is a form of selective regression testing: it narrows the suite to the tests most likely to catch a regression with the changes.
Test impact analysis vs. predictive test selection
Predictive test selection takes a different route: instead of a map, it uses a model trained on past test results to estimate which tests are likely to fail for a given change. Below, we outline how the four common approaches differ in what they use to choose tests.
|
Approach |
How tests are chosen |
Strengths |
Risks |
|
Retest-all |
Every test runs on every change |
Nothing is skipped |
Slowest feedback; cost grows with the suite |
|
Dependency-based TIA |
Build graph links tests to changed modules |
Deterministic and easy to explain |
Coarse when modules are large; needs accurate dependency declarations |
|
Coverage-based TIA |
Per-test coverage map links tests to changed files |
Fine-grained selection |
Map goes stale; misses changes coverage can't see, such as config |
|
Predictive test selection |
A model scores each test's chance of failing for this change |
Learns from real failure history |
Needs a large history and regular retraining; harder to explain a skip |
Meta's predictive test selection is the best-known example of the last row. For each change, a model trained on historical changes and test outcomes estimates the probability that each test will detect a regression. Meta reported that it caught more than 99.9% of regressions while running about a third of the tests that depended on the modified code. The model is retrained regularly on recent results, which is the upkeep cost most teams underestimate.
Test impact analysis in a CI pipeline
In CI, TIA runs as a short loop on every commit or pull request:
- Build the test-to-code map from a full run and store it with the repository or in your CI service.
- Read the diff for the commit or PR.
- Select the tests whose mapped code overlaps the diff.
- Run the selected tests and report results on the PR.
- Fall back to a broader run when the change can't be mapped, such as a new file type or a build script.
- Refresh the map from new runs so it tracks the code.
Mature implementations add guardrails around step 3. Datadog's Test Impact Analysis documentation describes three that apply to any setup: tests marked unskippable always run, changes to tracked files such as Dockerfiles or dependency manifests force a full run, and commits that change more than 5,000 files skip analysis and run everything. Each guardrail can only add tests, never remove them.
Wire the selection step into the same place your other checks run, for example CI pipelines with GitHub Actions, so results appear on the pull request.
Rolling out test impact analysis safely
Fix flaky tests first
A flaky test fails even when nothing is wrong with the code. If your test selection learns from failure history, it records that failure as if the change caused it and could start linking the test to unrelated code. Flaky failures also train developers to hit rerun instead of reading the failure. The problem is common at scale: Google reported that about 1.5% of all test runs report a flaky result. Take the time to quarantine tests that fail intermittently before switching TIA on, and fix the root cause. Many turn out to be real timing bugs, like the race condition hiding in a flaky test that mabl's team traced back to product code.
Keep a small set of tests that always run
Some journeys are too important to depend on the map. Smoke tests and business-critical flows, such as login, checkout, and payments, should run on every PR regardless of what TIA selects. The key is to keep the set small so it stays reliable. mabl's own PR gate with 17 tests covers one or two tests per user journey instead of the 288 an agent first proposed, because a large gate that fails falsely gets ignored. The small set of tests, if they fail, are manageable to work through.
Gate pull requests on impacted tests
Report-only results are easy to skip. Once the map is trusted, block the merge when an impacted test fails so the author owns the fix while the change is fresh. Allow an override, but make it a labeled action that gets logged and justified. mabl's engineering team took this approach with blocking PR gates with test impact analysis. In its first four weeks, the TIA gate caught three bugs before merge and flagged three tests that needed updating to match intended changes.
Run the full suite on a schedule
Selection will miss things, so those misses need a deadline. Run the full suite nightly or before each release as part of automated regression testing. When it catches a failure that TIA skipped, treat that as a map defect: find why the test wasn't linked to the change and fix the mapping.
Run selected tests in parallel
Selection cuts the number of tests; parallel test execution cuts the amount of time needed for the ones that are left. As an example, 40 selected tests averaging three minutes each take two hours in sequence, but only minutes when run in parallel. Feedback that fast keeps the gate in the developer's working session.
Limits of test impact analysis
TIA only sees what its map can see. These changes regularly slip past it:
- Configuration and feature-flag changes that alter behavior without touching mapped code
- Test data, fixtures, and database schema changes
- CSS-only UI changes, which coverage tools don't attribute to tests
- Cross-service contract changes, where the affected tests live in another repository
- New code with no coverage yet, so no test maps to it
Some tools handle part of this by falling back. Microsoft's Test Impact Analysis runs all tests when a commit contains a file type it can't reason about, such as HTML or CSS. New code is the harder case. As a rule, you should report a change with no mapped tests as a coverage gap, and never count it as a pass.
Test impact analysis for end-to-end tests and AI-generated changes
End-to-end tests exercise many components in one run, so a code-coverage map links nearly every test to nearly every change. Teams sharpen selection by tagging tests with the user journeys they cover and weighting by test history, such as which tests failed on similar changes before.
AI-generated code raises the stakes. The 2025 DORA report found that about 90% of technology professionals use AI at work, and describes AI as an amplifier of a team's existing strengths and weaknesses. More and larger PRs make selection more valuable, and they make it more important that selection runs separately from the agent that wrote the code. That separation is a core idea in autonomous software testing.
mabl's test impact analysis gate
mabl finds existing coverage related to the change in a pull request, runs it, and can block the merge when that coverage fails, if the team's change validation policy requires it. The results show which tests ran, why they were selected, and whether the change had any coverage at all, so a gap shows up as an actual gap instead of a pass because nothing tested it.
The gate is one way teams verify code before merge. Developers and their coding agents can reach the same results through the mabl MCP server, which lets an agent find and run the tests related to a change and investigate failures from the IDE.
Next step: pilot TIA on one repository
Pick one repository with a suite your team already trusts. Run TIA in report-only mode for two weeks alongside the full suite, and log every failure the full suite caught that TIA skipped. If that list is short and explainable, turn on the gate.
See how mabl selects and runs the tests each change needs. Request a demo.
Frequently asked questions
What is test impact analysis in CI?
On each commit or pull request, the CI pipeline reads the change, looks up which tests are mapped to the changed code, and runs only those. It falls back to a full run for changes it can't map, such as build files or very large commits.
Is test impact analysis the same as predictive test selection?
No. Test impact analysis chooses tests from a map of which code each test exercises. Predictive test selection uses a model trained on historical outcomes to rank tests by their chance of failing. Many teams combine the two.
Can test impact analysis miss bugs?
Yes, when a change falls outside the map, such as configuration, test data, CSS, or another service's contract. Two safety nets cover this: a small set of tests that always run, and a scheduled full regression run.
Quality Engineering Resources

Playwright MCP for testers
What Playwright MCP is, how to set it up in Claude Code, how it compares to agent-browser and Claude in Chrome, and why testers need an independent check.
Learn More
Your best engineers shouldn’t have to become managers to matter
AI coding agents raised the floor for every engineer. Learn why mabl is building a technical leadership path that matters as much as management.
Learn More
The agentic SDLC: from code generation to independent verification
See how the agentic SDLC changes planning, coding, review, testing, and release, and why independent verification keeps AI-generated code safe to ship.
Learn More