RunTestsResult

Contains information about the execution of unit tests, including whether unit tests were completed successfully, code coverage results, and failures.

A RunTestsResult object has the following properties:

Name Type Description
apexLogId string

The ID of an ApexLog object that is created at the end of a test run. The ApexLog object is created if there is an active trace flag on the user running an Apex test, or on a class or trigger being executed.

This field is available in API version 35.0 and later.

codeCoverage CodeCoverageResult[]

An array of one or more CodeCoverageResult objects that contains the details of the code coverage for the specified unit tests.

codeCoverageWarnings CodeCoverageWarning[]

An array of one or more code coverage warnings for the test run. The results include both the total number of lines that could have been executed, as well as the number, line, and column positions of code that was not executed.

failures RunTestFailure[]

An array of one or more RunTestFailure objects that contain information about the unit test failures, if there are any.

flowCoverage FlowCoverageResult[] An array of results from test runs that executed flows. This field is available in API version 44.0 and later.
flowCoverageWarnings FlowCoverageWarning[] An array of warnings generated by test runs that executed flows. This field is available in API version 44.0 and later.
numFailures int

The number of failures for the unit tests.

numTestsRun int

The number of unit tests that were run.

successes RunTestSuccess[]

An array of one or more RunTestSuccess objects that contain information about successes, if there are any.

totalTime double

The total cumulative time spent running tests, in milliseconds. This can be helpful for performance monitoring.

CodeCoverageResult

The RunTestsResult object contains this object. It contains information about whether or not the compile of the specified Apex and run of the unit tests was successful.

A CodeCoverageResult object has the following properties:

Name Type Description
dmlInfo CodeLocation[]

For each class or trigger tested, for each portion of code tested, this property contains the DML statement locations, the number of times the code was executed, and the total cumulative time spent in these calls. This can be helpful for performance monitoring.

id ID

The ID of the CodeLocation. The ID is unique within an organization.

locationsNotCovered CodeLocation[]

For each class or trigger tested, if any code is not covered, the line and column of the code not tested, and the number of times the code was executed.

methodInfo CodeLocation[]

For each class or trigger tested, the method invocation locations, the number of times the code was executed, and the total cumulative time spent in these calls. This can be helpful for performance monitoring.

name string

The name of the class or trigger covered.

namespace string

The namespace that contained the unit tests, if one is specified.

numLocations int

The total number of code locations.

numLocationsNotCovered int

The number of code locations not covered by any class or trigger.

soqlInfo CodeLocation[]

For each class or trigger tested, the location of SOQL statements in the code, the number of times this code was executed, and the total cumulative time spent in these calls. This can be helpful for performance monitoring.

soslInfo CodeLocation[]

For each class tested, the location of SOSL statements in the code, the number of times this code was executed, and the total cumulative time spent in these calls. This can be helpful for performance monitoring.

type string

Do not use. In early, unsupported releases, used to specify class or package.

CodeCoverageWarning

The RunTestsResult object contains this object. It contains information about the Apex class which generated warnings.

This object has the following properties:

Name Type Description
id ID

The ID of the class which generated warnings.

message string

The message of the warning generated.

name string

The name of the class that generated a warning. If the warning applies to the overall code coverage, this value is null.

namespace string

The namespace that contains the class, if one was specified.

RunTestFailure

The RunTestsResult object returns information about failures during the unit test run.

This object has the following properties:

Name Type Description
id ID

The ID of the class which generated failures.

message string

The failure message.

methodName string

The name of the method that failed.

name string

The name of the class that failed.

namespace string

The namespace that contained the class, if one was specified.

seeAllData boolean Indicates whether the test method has access to organization data (true) or not (false).

This field is available in API version 33.0 and later.

stackTrace string

The stack trace for the failure.

time double

The time spent running tests for this failed operation, in milliseconds. This can be helpful for performance monitoring.

type string

Do not use. In early, unsupported releases, used to specify class or package.

FlowCoverageResult

This object contains information about the flow version and the number of elements executed by the test run. This object is available in API version 44.0 and later.

Name Type Description
elementsNotCovered string List of elements in the flow version that weren’t executed by the test run.
flowId string The ID of the flow version. The ID is unique within an org.
flowName string The name of the flow that was executed by the test run.
flowNamespace string The namespace that contains the flow, if one is specified.
numElements int The total number of elements in the flow version.
numElementsNotCovered int The number of elements in the flow version that weren’t executed by the test run
processType FlowProcessType (enumeration of type string) The process type of the flow version.

FlowCoverageWarning

This object contains information about the flow version that generated warnings. This object is available in API version 44.0 and later.

Name Type Description
flowId string The ID of the flow version that generated the warning.
flowName string The name of the flow that generated the warning. If the warning applies to the overall test coverage of flows within your org, this value is null.
flowNamespace string The namespace that contains the flow, if one was specified.
message string The message of the warning that was generated.

RunTestSuccess

The RunTestsResult object returns information about successes during the unit test run.

This object has the following properties:

Name Type Description
id ID

The ID of the class which generated the success.

methodName string

The name of the method that succeeded.

name string

The name of the class that succeeded.

namespace string

The namespace that contained the class, if one was specified.

seeAllData boolean Indicates whether the test method has access to organization data (true) or not (false).

This field is available in API version 33.0 and later.

time double

The time spent running tests for this operation. This can be helpful for performance monitoring.

CodeLocation

The RunTestsResult object contains this object in a number of fields.

This object has the following properties:

Name Type Description
column int

The column location of the Apex tested.

line int

The line location of the Apex tested.

numExecutions int

The number of times the Apex was executed in the test run.

time double

The total cumulative time spent at this location. This can be helpful for performance monitoring.