ApexTestQueueItem

Represents a single Apex class in the Apex job queue.

Introduced in API version 23.0.

create(), describeSObjects(), query(), retrieve(), update(), upsert()

  • In API version 49.0 and later, users must have the View Setup and Configuration permission to access this object.
  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort

  • Description:

    The Apex class whose tests are to be executed.

    This is a relationship field.

  • Relationship name: ApexClass

  • Relationship type: relationship

  • Refers to: ApexClass

  • Type: string

  • Properties: Filter, Nillable, Sort

  • Description:

    The pass rate of the test run.

    For example: “(4/6)”. This means that four out of a total of six tests passed.

    If the class fails to execute, this field contains the cause of the failure.

  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Description:

    Points to the AsyncApexJob that represents the entire test run.

    If you insert multiple Apex test queue items in a single bulk operation, the queue items share the same parent job. This means that a test run can consist of the execution of the tests of several classes if all the test queue items are inserted in the same bulk operation.

  • Relationship name: ParentJob

  • Relationship type: relationship

  • Refers to: AsyncApexJob

  • Type: boolean
  • Properties: Create, Defaulted on create, Filter, Group, Sort, Update
  • Introduced: API version 43.0
  • Description: Indicates whether to opt out of collecting code coverage information during Apex test runs.
  • Default value: false
  • Type: picklist
  • Properties: Filter, Group, Restricted picklist, Sort, Update
  • Description: The status of the job.1 This status applies to batch jobs in the Apex flex queue.
  • Possible values:
    • Holding — Holding
    • Queued — Queued
    • Preparing — Preparing
    • Processing — Processing
    • Aborted — Aborted
    • Completed — Completed
    • Failed — Failed
  • Type: reference
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 37.0
  • Description: The ID of the associated ApexTestRunResult object.
  • Relationship name: TestRunResult
  • Relationship type: relationship
  • Refers to: ApexTestRunResult

Insert an ApexTestQueueItem object to place its corresponding Apex class in the Apex job queue for execution. The Apex job executes the test methods in the class.

To abort a class that is in the Apex job queue, perform an update operation on the ApexTestQueueItem object and set its Status field to Aborted.

If you insert multiple Apex test queue items in a single bulk operation, the queue items share the same parent job. This means that a test run can consist of the execution of the tests of several classes if all the test queue items are inserted in the same bulk operation.