---
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 is a feature introduced in the Australia release that tracks which lines of your custom scripts execute during Automated Test Framework (ATF) test runs.
It provides detailed visibility into test coverage at multiple levels, helping you assess test quality, identify untested code, and evaluate deployment risk within ReleaseOps.
Show full answer Show less  
This feature supports server-side, client-side, global scope, and application-scoped scripts, enabling comprehensive coverage analysis across your customizations.

## Key Features

* **Line-level coverage tracking:** Identifies specific lines of code executed during tests, pinpointing exact code paths exercised.
* **Coverage aggregation:** Combines data from multiple test runs to show cumulative coverage across tests, scripts, and deployment requests.
* **Traced records:** Captures metadata and table records accessed during tests, linking them to coverage data for in-depth analysis.
* **Test result integration:** Correlates coverage data with test outcomes, supporting triage and troubleshooting of test failures.
* **Deployment risk assessment:** Automatically evaluates code coverage in deployment requests, blocking deployments with coverage below a configurable threshold (default 70%).
* **Programmatic access:** Provides REST API endpoints to retrieve and analyze coverage data for scripts and deployments, facilitating automation and reporting.

## Practical Use Cases

* **Improving test quality:** Identify critical code areas lacking tests to prioritize additional test creation.
* **Reducing deployment risk:** Ensure recently changed code is adequately tested before deployment by reviewing coverage metrics.
* **Test triage and troubleshooting:** Use coverage data combined with metadata tracing to diagnose test failures effectively.
* **Deployment request evaluation:** Automatically assess code coverage during deployment workflow to enforce quality gates.

## Configuration and Limitations

* You can adjust the code coverage threshold in the deployment assessment playbook to fit your organizational risk tolerance.
* Code coverage collection may affect test execution performance; it can be disabled globally or per script if needed.
* Data truncation can occur for large API payloads; truncation flags and messages will indicate incomplete data.
* Coverage only applies to executable code run in the Rhino engine or browser; static configurations and non-executable metadata are excluded.
* If tracing is interrupted due to system thresholds, coverage data may be incomplete and marked accordingly on test results.

## Integration with ServiceNow Features

* **Automated Test Framework (ATF):** Generates the coverage data during test runs.
* **Test Triage:** Utilizes coverage and metadata tracing to analyze test failures.
* **ReleaseOps:** Incorporates coverage evaluation in deployment request workflows for risk management.
* **Deployment Analyzer:** Leverages coverage data to assess deployment readiness.

ATF Code Coverage empowers ServiceNow customers to gain precise insight into test effectiveness, prioritize testing efforts, and enforce quality controls in deployment processes, ultimately reducing risk and improving reliability of customizations.  
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}

