Newer Version Available
FlowTestCoverage
Supported SOAP Calls
delete(), describeSObjects(), query(), retrieve(), update()
Supported REST HTTP Methods
GET, HEAD
Fields
| Field | Details |
|---|---|
| ApexTestClassId |
|
| FlowVersionId |
|
| NumElementsCovered |
|
| NumElementsNotCovered |
|
| TestMethodName |
|
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.
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.
1SELECT FlowVersion.Definition.DeveloperName
2FROM FlowTestCoverage
3GROUP BY FlowVersion.Definition.DeveloperNameGet the names of all active autolaunched flows and processes that don’t have test coverage.
1SELECT Definition.DeveloperName
2FROM Flow
3WHERE Status = 'Active'
4 AND (ProcessType = 'AutolaunchedFlow' OR ProcessType = 'Workflow' OR ProcessType = 'CustomEvent' OR ProcessType = 'InvocableProcess')
5 AND Id NOT IN (SELECT FlowVersionId FROM FlowTestCoverage)Get overall test coverage for a flow version.
1SELECT Id, ApexTestClassId, TestMethodName, FlowVersionId, NumElementsCovered, NumElementsNotCovered
2FROM FlowTestCoverage
3WHERE flowversionid='301RM0000004GiK'