ApexTestResult

Note
The API for asynchronous test runs is a Beta release.

Represents the result of an Apex test method execution. This object is available in API version 23.0 and later.

Supported Calls

describeSObjects(), query(), retrieve()

Fields

Field Name Details
ApexClassId
Type
reference
Properties
Filter, Group, Sort
Description

The Apex class whose test methods were executed.

ApexLogId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description

Points to the ApexLog for this test method execution if debug logging is enabled; otherwise, null.

AsyncApexJobId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description

Read-only. Points to the AsyncApexJob that represents the entire test run.

This field points to the same object as ApexTestQueueItem.ParentJobId.

Message
Type
string
Properties
Filter, Nillable, Sort
Description

The exception error message if a test failure occurs; otherwise, null.

MethodName
Type
string
Properties
Filter, Group, Nillable, Sort
Description

The test method name.

Outcome
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
The result of the test method execution. Can be one of these values:
  • Pass
  • Fail
  • CompileFail
QueueItemId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description

Points to the ApexTestQueueItem which is the class that this test method is part of.

StackTrace
Type
string
Properties
Filter, Nillable, Sort
Description

The Apex stack trace if the test failed; otherwise, null.

TestTimestamp
Type
dateTime
Properties
Filter, Sort
Description

The start time of the test method.

Usage

You can query the fields of the ApexTestResult record that corresponds to a test method executed as part of an Apex class execution.

Each test method execution is represented by a single ApexTestResult record. For example, if an Apex test class contains six test methods, six ApexTestResult records are created. These records are in addition to the ApexTestQueueItem record that represents the Apex class.

© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.