Deployed test coverage
Deployed test coverage: measure what your tests run on real environments
Deployed test coverage is code coverage measured on running services in a test, staging or pre-production environment, while your suites and testers use it. CoverOps does it with an agent inside each deployed service that uploads as it runs, and files the coverage under the test and the run that caused it, per environment.
By the CoverOps team · Last updated
Why teams choose CoverOps for deployed test coverage
Built for environments that never stop
Each pipeline's suite gets its own run on long-lived services, monitoring windows add up days of manual and automated testing, and redeploys, restarts and replicas are handled by rule.
End-to-end, API and manual tests all count
Line-level coverage of the running services, per test where the test names itself, so the tests that take most of your regression time finally show up in the coverage picture.
Find the code that shipped and never ran
Coverage read backwards over a window and an environment: the methods that were loaded and never executed, with never-loaded code kept apart as unknown.
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.
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.
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.
Coverage where the tests actually run
Coverage tools grew up around the build: run the unit tests, write a report, publish a number. The slower tests run somewhere else. End-to-end suites, API tests, contract checks and manual regression all hit a deployed environment, often for hours or days, against services that are never stopped and are shared with other people's traffic.
Measuring there raises questions a build never has. Which run does a long-lived service report into? What if the suite runs while a teammate clicks through by hand? What happens to coverage when a new build is deployed halfway through the regression? How do five pods of one service count? CoverOps answers each of these in the product, and the answers are below.
How it works on a deployed environment
- Ship the agent with each service and configure it from the deployment: endpoint, token, the package prefixes to measure, and
COVERAGEOPS_ENVIRONMENT(test,staging,preprod). On Kubernetes, a mutating webhook can attach the Java and Node.js agents to any pod with thecoverageops.io/attachannotation. - Automated suites open their own run before the first test (the runner plugins do this) and label their traffic. A deployed service files each labelled request under that run while it is open, so one pipeline's suite gets its own result even though the services were started days ago.
- For everything else, open a coverage monitoring window: every agent of the project reports into it until you stop it, manual testing and unlabelled traffic included. Start and stop it from the dashboard, the REST API or an AI assistant over MCP.
- Read the result by environment. One run can hold pods from several environments; each keeps its own, and the run page filters by it.
env:
- name: JAVA_TOOL_OPTIONS
value: "-javaagent:/opt/coverageops/agent.jar"
- name: COVERAGEOPS_ENDPOINT
value: "https://api.coverops.ai"
- name: COVERAGEOPS_INCLUDES
value: "com.yourcompany"
- name: COVERAGEOPS_SERVICE
value: "orders-api"
- name: COVERAGEOPS_ENVIRONMENT
value: "staging"
- name: COVERAGEOPS_TRACE # per-test attribution on the JVM
value: "true"
- name: COVERAGEOPS_TOKEN
valueFrom:
secretKeyRef: { name: coverageops, key: agentToken }The pod name is the replica (HOSTNAME by default): five pods of orders-api are five participants, merged into one service on the run page. A line any replica ran is covered.
What happens on a live environment
Deployed environments change under the measurement. These are the rules CoverOps applies, so a number means the same thing every time.
- A redeploy during a window: for files the new build changed, earlier coverage is dropped and counting starts again from the new build. Everything else keeps its history, and the run page says when it happened.
- A service restart: each upload is the process's running total, merged by taking the larger count per line, so a restarted process keeps what it had covered.
- Someone else's traffic: a monitoring window counts everything the agents see while it is open. Labelled test traffic is still attributed to its test, and a run opened by a suite only takes the traffic labelled with it.
- Quiet services: an agent sends nothing while nothing changes, and a run with no data for 6 hours closes itself. Monitoring windows never close that way.
What you get
Per-test backend footprint
For each test: the endpoints it called, the services each call crossed, the methods that ran and the lines it executed, linked from the test runner's own report.
Code that shipped and never ran
Over a window and an environment you choose, the methods the agents measured and nothing executed. Methods no agent ever loaded are counted apart, as unknown, because they cannot be called dead on evidence.
A changed-code gate
Of the lines a pull request changed, how many did the tests of its build execute? coverageops gate answers in CI and can post the verdict as a commit status on GitHub, GitLab, Azure DevOps or Bitbucket.
Days of testing in one number
A monitoring window adds up automated passes and manual testing until you stop it. A second window can measure a shorter stretch inside it, from zero, without disturbing the first.
What is measured, and what is not
Measured
- Lines and methods of every deployed service with an agent (branches on Java and Node.js), per replica and merged per service.
- Per test, for traffic that carries the test context; per run or monitoring window for everything else.
- The environment each process reported from, so test, staging and pre-production never mix.
Not measured
- Request or response bodies, argument values or customer data: agents send file paths, class and method names and which lines ran, plus source text unless you turn it off.
- Services without an agent, and code outside the package prefixes you chose to measure.
- Production, unless your package includes it: Startup and Pro are for test and staging; production monitoring is an add-on on Business and included in Enterprise.
Frequently asked questions
Can you measure code coverage on a running staging environment?
Yes. Start each service with a coverage agent that uploads while it runs. CoverOps agents do, and they file the coverage under the run that is open: the one your test runner opened, or a monitoring window started from the dashboard.
Do the services have to be restarted for each test run?
No. A runner opens its run before the first test, and its labelled traffic is filed there while the run is open. Traffic can only choose among runs that are already open in the project; it never opens one.
How do manual tests on staging count?
Start a coverage monitoring window before the manual regression and stop it when it ends. Everything the agents see in between adds up into that window. A tester can also name a case with the ?covtest= query parameter on a navigation.
Does it slow down the deployed services?
It adds some work, and how much depends on the agent and the service. The Java agent's probe is a few bytecodes with uploads off the request path, and its documentation reports a synthetic worst case within noise; call-chain tracing costs more, and other runtimes differ. We publish no overhead figure for real applications, so measure your own service in a test environment first. Tracing can be sampled.
Can it run in production?
Yes, on a package that includes production. There, coverage read backwards shows the code that shipped and never ran. Production monitoring is an add-on on Business and included in Enterprise.
Keep reading
Related pages
In the documentation
- Runs, monitoring windows, replicas and environments
- Coverage monitoring
- Dead code
- Agents: tokens, environments and setup
The documentation is in English.
Measure your staging environment
Bring one deployed service to a demo; we show how a suite and a manual session each get their own coverage on it.