Skip to content

AI test coverage

AI test coverage: prove what AI-written tests really run, and give your agents the data

AI test coverage has two sides. One is checking AI-generated tests: CoverOps measures the code each test actually executes on your running services, so a test that passes while reaching nothing is visible, and a changed-code gate checks AI-written pull requests. The other is giving AI coding agents that data: CoverOps answers coverage, impact and flaky-test questions over MCP. It does not write tests itself.

By the CoverOps team · Last updated

Why teams choose CoverOps for AI test coverage

  • Proof of what AI-written tests execute

    Line-level coverage of the running services for every test, whoever wrote it, so a generated test that passes while reaching nothing stands out.

    See what a test's footprint shows

  • Your coding agent asks CoverOps directly

    An MCP server with tools for impact, test footprints, file coverage, the gate, failure causes and flaky tests, scoped to the person whose token it uses and recorded in the audit log.

    Read the API and MCP guide

  • A merge gate on the code that changed

    Block or flag a pull request when its changed lines were not executed by the tests of its build, with the verdict on the commit status and, on GitHub, a comment listing the lines no test ran.

    Read the quality gate guide

  • Skip tests safely, with a reason for every skip

    A test is skipped only when its recorded footprint misses every changed line, and the report says why. Observation mode shows what would have been skipped before anything is, and when the change cannot be read in full, everything runs.

    Read the test selection guide

  • Cloud, self-hosted or air-gapped

    Use the hosted service in AWS Frankfurt, or run CoverOps in your private cloud, on your own servers or fully offline.

    Security and data handling

  • ISO/IEC 27001, 27701 and ISO 9001

    Certified to ISO/IEC 27001:2022, ISO/IEC 27701 and ISO 9001. SOC 2 Type 2 is coming soon.

    Certifications and security

Why AI-written tests need measuring

Coding assistants write a growing share of new tests, and they are good at producing tests that pass. Passing is the easy part. An agent asked to raise coverage can mock the service it was meant to exercise, call an endpoint that returns early, or assert on a value it set itself, and the suite gets greener while the code that matters is never run.

A unit-test coverage report catches some of that, inside one process. It does not see an end-to-end or API test an agent wrote against a deployed system, which is where many of them go. Runtime coverage per test does: for each test, the services it reached and the lines it executed there.

The same data is useful in the other direction. An agent that can ask which tests a change affects, which changed lines no test runs, and why a test failed writes better changes than one guessing from the source.

How it works

  1. Run your services with CoverOps agents and your suites with the runner plugins, as for any tests. A test an AI wrote is measured exactly like one a person wrote: by its name on the requests it sends.
  2. Add the changed-code gate to pull requests. On GitHub, coverageops gate --comment writes the share of changed code the tests ran on the pull request, with a table of changed lines no test ran; on GitLab, Azure DevOps and Bitbucket the verdict goes on the commit status.
  3. Mint an API token under Team → API tokens and connect your assistant to CoverOps' MCP server. Claude, Cursor, VS Code and anything that speaks Streamable HTTP with a static header can use it.
  4. Ask in the conversation: which tests does this change affect, which of my changed lines did no test run, what did this test do on the backend, why did these tests fail.
Connect Claude Code (the token acts as you, within its scope)
claude mcp add --transport http coverops https://<your CoverOps>/v1/mcp \
  --header "Authorization: Bearer cov_api_…"
Gate an AI-written pull request in CI
coverageops gate --base origin/main --min-changed 80 --comment
# 0 passed · 1 a blocking rule failed · 2 misconfigured

What an AI agent can ask CoverOps over MCP

Each tool is a question the dashboard already answers, asked as the person whose token is used: the same projects, the same numbers, the same audit trail. These are the tools an agent writing or fixing tests uses most:

  • impact_plan: which tests a set of commits affects, matched against what every test executed.
  • suggest_tests: the known tests to run for a change, and the changed files no test reaches, ranked by risk with the symbols a new test would be written around.
  • test_footprint: what one test did on the backend: endpoints, services, methods and lines, in request order.
  • file_coverage: which lines of a file ran and which never did, in the latest run or a named one.
  • quality_gate, why_failed, flaky_tests, change_risk and dead_code: the gate verdict, the cause of each failure, flaky tests, risk per changed file, and code that never ran.
  • With a write-scoped token, start_coverage_monitoring and stop_coverage_monitoring, so an agent exploring an app can measure its own session.

What you get

Tests that pass and reach nothing

Each test's detail shows the requests it caused and the lines it ran on every service. A generated test whose flow is empty, or that only ever touches a mock, stands out next to tests that do real work.

Read the guide

A gate for AI-written changes

The gate asks what share of the lines a pull request changed the tests of its build executed, whoever wrote the code and the tests, and can block the merge or only report.

Read the guide

Where a new test is needed

Impact lists the changed files no test reached, with a risk score per file from the code map. That is the list to hand to an agent, or a person, writing the next tests.

Read the guide

Flaky test detection

Tests that passed on retry, passed and failed on the same commit, or flip back and forth on a branch are scored, and a confirmed flake can be quarantined so its failures stop blocking a build.

Read the guide

What is measured, and what is not

Measured

  • The lines, methods and services every test executed, whoever or whatever wrote it, on services with an agent.
  • Changed-code coverage of each pull request, and the changed lines no test ran.
  • An AI agent's exploratory session on a test environment, inside a monitoring window it can start and stop itself.

Not measured

  • Whether a test checks the right thing. A line can run under a test that asserts nothing about its result; coverage finds what is not tested, it does not grade what is. Review and mutation testing answer the rest.
  • Which tests an AI wrote. CoverOps does not tell AI-written tests from human ones; the gate and footprints apply to both.
  • Testing of AI models themselves: their behaviour is learned, not written as code, and code coverage says little about it.

Frequently asked questions

Does CoverOps generate tests with AI?

No. It measures what tests execute and tells you, or your coding agent, where tests are missing: the changed files no test reaches and the symbols a new test would be written around. Writing the test is left to you or your agent.

How do I know if AI-generated tests are any good?

Start with what they execute: a test that reaches none of the code it is named after is not testing it. Then check the changed-code coverage of the pull request that added them. Coverage cannot tell you whether the assertions are meaningful, so review them or use mutation testing for that part.

Which AI assistants can connect to CoverOps?

Any MCP client that can send a static Authorization header over Streamable HTTP: Claude Code, Cursor and VS Code among them. Clients that only support OAuth cannot connect yet.

Can an AI agent change anything in CoverOps?

Only with a write-scoped token, and only what that person may do: start and stop coverage monitoring, rebuild the code map and post a notification. Every call is in the access log under the token, and every write tool leaves an audit entry.

Is test coverage still useful when AI writes most of the code?

More than before, used the right way. When code arrives faster than people can review it, knowing which changed lines no test executed is the cheapest check that something was tested at all.

See what your AI-written tests actually run

In a demo we run a suite against a multi-service app, open each test's footprint and ask the same questions over MCP.