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
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.

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. 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.

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. This can be helpful for performance monitoring.

type string

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

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.

Previous
Next