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:

NameTypeDescription
apexLogIdstringThe 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.
codeCoverageCodeCoverageResult[]An array of one or more CodeCoverageResult objects that contains the details of the code coverage for the specified unit tests.
codeCoverageWarningsCodeCoverageWarning[]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.
failuresRunTestFailure[]An array of one or more RunTestFailure objects that contain information about the unit test failures, if there are any.
flowCoverageFlowCoverageResult[]An array of results from test runs that executed flows. This field is available in API version 44.0 and later.
flowCoverageWarningsFlowCoverageWarning[]An array of warnings generated by test runs that executed flows. This field is available in API version 44.0 and later.
numFailuresintThe number of failures for the unit tests.
numTestsRunintThe number of unit tests that were run.
successesRunTestSuccess[]An array of one or more RunTestSuccess objects that contain information about successes, if there are any.
totalTimedoubleThe 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:

NameTypeDescription
dmlInfoCodeLocation[]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.
idIDThe ID of the CodeLocation. The ID is unique within an organization.
locationsNotCoveredCodeLocation[]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.
methodInfoCodeLocation[]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.
namestringThe name of the class or trigger covered.
namespacestringThe namespace that contained the unit tests, if one is specified.
numLocationsintThe total number of code locations.
numLocationsNotCoveredintThe number of code locations not covered by any class or trigger.
soqlInfoCodeLocation[]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.
soslInfoCodeLocation[]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.
typestringDo 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:

NameTypeDescription
idIDThe ID of the class which generated warnings.
messagestringThe message of the warning generated.
namestringThe name of the class that generated a warning. If the warning applies to the overall code coverage, this value is null.
namespacestringThe 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:

NameTypeDescription
idIDThe ID of the class which generated failures.
messagestringThe failure message.
methodNamestringThe name of the method that failed.
namestringThe name of the class that failed.
namespacestringThe namespace that contained the class, if one was specified.
seeAllDatabooleanIndicates whether the test method has access to organization data (true) or not (false). This field is available in API version 33.0 and later.
stackTracestringThe stack trace for the failure.
timedoubleThe time spent running tests for this failed operation, in milliseconds. This can be helpful for performance monitoring.
typestringDo 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.

NameTypeDescription
elementsNotCoveredstringList of elements in the flow version that weren’t executed by the test run.
flowIdstringThe ID of the flow version. The ID is unique within an org.
flowNamestringThe name of the flow that was executed by the test run.
flowNamespacestringThe namespace that contains the flow, if one is specified.
numElementsintThe total number of elements in the flow version.
numElementsNotCoveredintThe number of elements in the flow version that weren’t executed by the test run
processTypeFlowProcessType (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.

NameTypeDescription
flowIdstringThe ID of the flow version that generated the warning.
flowNamestringThe 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.
flowNamespacestringThe namespace that contains the flow, if one was specified.
messagestringThe 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:

NameTypeDescription
idIDThe ID of the class which generated the success.
methodNamestringThe name of the method that succeeded.
namestringThe name of the class that succeeded.
namespacestringThe namespace that contained the class, if one was specified.
seeAllDatabooleanIndicates whether the test method has access to organization data (true) or not (false). This field is available in API version 33.0 and later.
timedoubleThe 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:

NameTypeDescription
columnintThe column location of the Apex tested.
lineintThe line location of the Apex tested.
numExecutionsintThe number of times the Apex was executed in the test run.
timedoubleThe total cumulative time spent at this location. This can be helpful for performance monitoring.