---
schema_version: "1"
id: e74fe015e67e3f615ce63071e4f05d06460c413e5fd471ccac178c9ee754e0d8
title: FlowTestCoverage
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_tooling/tooling_api_objects_flowtestcoverage.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_flowtestcoverage.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 978f6047ba4ac4f6e941e769997baca26389b7465f7cb35c34208cb54c1217b0
description: Represents test coverage for a flow or process by a given Apex method. Available in API version 44.0 and later.
---
# FlowTestCoverage

Represents test coverage for a flow or process by a given Apex method. Available in API version 44.0 and later.

## Supported SOAP Calls

delete(), describeSObjects(), query(), retrieve(), update()

## Supported REST HTTP Methods

GET, HEAD

## Fields

| Field | Details |
| --- | --- |
| ApexTestClassId | 
Type

ID

Properties

Filter, Group, Sort, Update

Description

The ID of the Apex test class.



 |
| FlowVersionId | 

Type

ID

Properties

Filter, Group, Sort

Description

The ID of the flow version that was executed by the test method.



 |
| NumElementsCovered | 

Type

int

Properties

Filter, Group, Nillable, Sort, Update

Description

The number of elements that were executed by the test method.



 |
| NumElementsNotCovered | 

Type

int

Properties

Filter, Group, Nillable, Sort, Update

Description

The number of elements that weren’t executed by the test method.



 |
| TestMethodName | 

Type

string

Properties

Filter, Group, Nillable, Sort, Update

Description

The name of the Apex method that executed the flow version.



 |

## Usage

To deploy a process or autolaunched flow as active in production orgs, you must meet the flow test coverage requirement for your org. At least one Apex test must cover the flow test coverage percentage of the active processes and autolaunched flows. Flow test coverage requirements don’t apply to flows that have screens. FlowTestCoverage records are deleted when changes are saved to the associated flow version.

A flow version corresponds to a process built in Process Builder or a flow built in Flow Builder. For a process, Apex tests execute only the active version. For a flow, Apex tests execute the active version. When a flow has no active version, Apex tests execute the latest version.

![Tip](https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/images/icon_note_tip.png)

#### Tip

Make sure that **Deploy processes and flows as active** is enabled in your org’s process automation settings. Otherwise, when you deploy active flows and processes via change sets or Metadata API, they’re deployed as inactive.

To calculate your org’s flow test coverage, Salesforce divides the number of covered flows and processes by the sum of the number of active processes and active autolaunched flows.

## Sample Query

Get the names of all flows and processes that have test coverage.

SELECT FlowVersion.Definition.DeveloperName
FROM FlowTestCoverage
GROUP BY FlowVersion.Definition.DeveloperName

Get the names of all active autolaunched flows and processes that don’t have test coverage.

SELECT Definition.DeveloperName
FROM Flow
WHERE Status = 'Active'
      AND (ProcessType = 'AutolaunchedFlow' OR ProcessType = 'Workflow' OR ProcessType = 'CustomEvent' OR ProcessType = 'InvocableProcess')
      AND Id NOT IN (SELECT FlowVersionId FROM FlowTestCoverage)

Get overall test coverage for a flow version.

SELECT Id, ApexTestClassId, TestMethodName, FlowVersionId, NumElementsCovered, NumElementsNotCovered 
FROM FlowTestCoverage 
WHERE flowversionid='301RM0000004GiK'

#### See Also

- [_Salesforce Help_: Deploy Processes and Flows as Active](https://help.salesforce.com/s/articleView?id=platform.flow_distribute_deploy_active.htm&type=5&language=en_US "Salesforce Help: Deploy Processes and Flows as Active - HTML (New Window)")