---
sourceDocument: Australia Build or modify applications
sourceDocumentLink: https://www.servicenow.com/docs/r/australia/application-development

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# ATF Code Coverage

# ATF Code Coverage {#ariaid-title1}

Release version: Australia  
Updated September 14, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of ATF Code Coverage

ATF Code Coverage, introduced in the Australia release, enables ServiceNow customers to track which lines of custom script code are executed during Automated Test Framework (ATF) test runs.
This feature provides detailed visibility into test coverage at line, script, and deployment levels, helping customers identify untested code, validate test quality, and assess deployment risk within ReleaseOps workflows.
Show full answer Show less  

## Key Features

* **Supported Code Scopes:** Coverage includes server-side scripts (such as business rules, script includes), client-side scripts (client scripts, UI policies), global scope scripts, and application-scoped code.
* **Line-Level Coverage Tracking:** Tracks execution of individual lines of code during tests, aiding precise identification of tested and untested code paths.
* **Coverage Aggregation:** Aggregates coverage data across multiple test runs to provide cumulative results at test, test suite, script, and deployment levels.
* **Traced Records:** Captures metadata and records accessed during test runs to enrich analysis of code coverage and test impact.
* **Test Result Integration:** Associates coverage metrics with test outcomes, facilitating correlation between test failures and untested code.
* **Deployment Risk Assessment:** Integrates with ReleaseOps to automatically evaluate coverage before deployment requests, enforcing a default 70% coverage threshold to reduce risk.
* **Programmatic Access:** Provides REST API endpoints to retrieve and analyze coverage data by test suite, script, or line numbers, supporting automation and custom reporting.

## Practical Use Cases

* **Test Quality Improvement:** Identify critical untested code paths to prioritize additional test creation.
* **Deployment Risk Analysis:** Verify that custom code changes meet minimum coverage thresholds before deployment to minimize failures.
* **Test Triage and Troubleshooting:** Use coverage data along with metadata tracing to diagnose and understand test failures.
* **Deployment Request Assessment:** Automatically block or flag deployment requests with insufficient test coverage for review and remediation.

## Limitations and Considerations

* Enabling coverage collection may impact test performance; it can be disabled globally or per script if necessary.
* Coverage data storage is subject to database field length limits, with potential truncation for large payloads. Truncation is indicated in API responses.
* Only executable code running on the server-side Rhino engine or browser is covered; static metadata and configurations are excluded.
* If coverage tracing is interrupted due to thresholds, incomplete coverage data is flagged in test results.

## What to Expect

By leveraging ATF Code Coverage, ServiceNow customers gain precise insights into how thoroughly their custom scripts are tested. This empowers teams to improve test completeness, reduce deployment risks by enforcing coverage thresholds, and accelerate troubleshooting of test failures through integrated metadata tracing. The REST API support further allows customers to incorporate coverage data into their automation and reporting workflows for enhanced quality assurance.  
Metadata code coverage tracks which lines of code in your custom scripts are executed during ATF test runs. It helps identify untested code, validate test quality, and assess deployment risk in ReleaseOps.
Metadata code coverage is a testing and quality assurance feature that automatically collects and analyzes code coverage data when running ATF tests. It provides visibility into:

* Which lines of code in your scripts execute during test runs
* Code coverage percentages at the script level and deployment level
* Gaps in test coverage across your custom code
* Integration with test triage and test result analysis
{#atf-code-coverage__ul_hkz_qfs_4kc}

## Supported Code Scopes {#atf-code-coverage__supported-scopes}

Metadata code coverage can track code execution in the following scopes:

* Server-side scripts: Business rules, script includes, workflow activities, and other server-side code written in Rhino JavaScript
* Client-side scripts: Client scripts, UI policies, and other client-side code executed in the browser
* Global scope code: Custom global scope scripts and libraries
* Application-scoped code: Code within specific application scopes can be filtered and analyzed separately
{#atf-code-coverage__ul_ikz_qfs_4kc}

## Key Concepts {#atf-code-coverage__key-concepts}

Line
coverage tracks whether individual lines of code in a script were executed during a test run. Line-level granularity helps identify which specific code paths are exercised by your tests.

Coverage
aggregation combines coverage data from multiple test runs to show cumulative coverage at the test, test suite, script, and deployment levels.

Traced
records are captured during test execution with code coverage enabled. The system records which table records and metadata attributes are accessed by your scripts. This tracing data is linked to coverage records for detailed
analysis.

Test
result integration captures code coverage metrics at the test, test suite, and test result levels, allowing you to correlate test outcomes with the code paths they exercise.

## Use Cases {#atf-code-coverage__use-cases}

Test
quality assessment uses code coverage data to identify critical code paths that lack test coverage and prioritize writing additional tests for those areas.

Deployment
risk analysis reviews code coverage data before deploying custom code changes to verify the modified code is adequately tested. Low coverage on recently changed code indicates higher deployment risk.

Test
triage and troubleshooting uses code coverage data to support the Test Triage feature. This feature helps identify why tests fail by showing which code paths were exercised and which metadata was modified.

Deployment
request assessment in ReleaseOps automatically evaluates code coverage as part of the deployment request assessment process. By default, if custom code coverage is below 70%, the deployment request transitions to the Reconciling state
and a test failure task is created.

## Deployment Coverage Threshold {#atf-code-coverage__deployment-threshold}

Metadata code coverage integrates with ReleaseOps deployment assessment. By default, if custom code in a deployment request has less than 70% ATF test coverage, the following occurs:

* The deployment request transitions to the `Reconciling` state
* A test failure task is automatically created
* Deployment is blocked pending review and potential remediation

{#atf-code-coverage__ul_jkz_qfs_4kc}

You can adjust the coverage threshold in the deployment request assessment playbook. See [Set Automated Test Framework (ATF) code coverage](https://www.servicenow.com/docs/AJuTfFteWhd_Z_E3P15bzg "Define what percentage of code coverage results in Automated Test Framework (ATF) test failure tasks that require remediation.") for configuration details.

## Limitations and Considerations {#atf-code-coverage__limitations}

When working with metadata code coverage, be aware of the following:

* Code coverage collection may impact test performance. The system includes thresholds to prevent excessive data accumulation.
* Code coverage can be disabled globally or at the script level if performance becomes a concern.
* Data truncation: Large API request payloads may be truncated when persisted. By default, fields are limited to 4,000 characters. When truncation occurs, a `was_truncated` flag is set to `true` in the API response, with details provided in the `truncation_message` field. You can adjust the default limit using the `glide.db.truncate_utf8` system property.
* Coverage data is subject to database field length constraints. Fields affected include test_suite_results, test_results, and metadata_info JSON arrays.
* Code coverage only includes code executed by the server-side Rhino engine or browser; static metadata, configurations, and non-executable records are not covered.
* When tracing is interrupted due to threshold constraints, an indicator is recorded on the test result to show that coverage data is incomplete.
{#atf-code-coverage__ul_kkz_qfs_4kc}

## Availability {#atf-code-coverage__availability}

Metadata code coverage is available
starting
with the Australia release.

## Programmatic Access {#atf-code-coverage__programmatic-access}

You can retrieve and analyze code coverage data programmatically using the ATF Code Coverage REST API. The API provides three main endpoints for computing code coverage:

* `POST /api/now/atf/code_coverage/all` --- Aggregates coverage across all scripts covered by specified test suite or test runs
* `POST /api/now/atf/code_coverage/by_script_id` --- Computes coverage for specific script records
* `POST /api/now/atf/code_coverage/by_line_number` --- Computes coverage using filtered line numbers per metadata record

{#atf-code-coverage__ul_lkz_qfs_4kc}

Each endpoint returns coverage percentages at the script and deployment levels, along with metadata about the request and any data truncation warnings. For detailed API specifications, parameter documentation, and code examples, see [ATF Code Coverage API](https://www.servicenow.com/docs/access?context=atf-code-coverage-api&version=australia&pubname=australia-api-reference&ft:locale=en-US).

## Related Features {#atf-code-coverage__related-features}

* Automated Test Framework (ATF): The testing framework that generates code coverage data during test execution
* Test Triage: Analyzes test failures using code coverage and metadata tracing to identify root causes
* ReleaseOps: Integrates code coverage assessment into deployment request workflows
* Deployment Analyzer: Uses code coverage data to assess deployment readiness and risk
{#atf-code-coverage__ul_mkz_qfs_4kc}

