TestSuiteMembership

Associates an Apex class with an ApexTestSuite.

Version 

Introduced in API version 36.0.

Supported SOAP API Calls 

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

Supported REST API Methods 

DELETE, GET, HEAD, PATCH, POST, Query

Fields 

ApexClassId 

  • Type: reference

  • Required: No

  • Properties: Create, Filter, Group, Sort

  • Description: The Apex class whose tests are to be executed.

This is a relationship field.

  • Relationship name: ApexClass
  • Relationship type: masterdetail
  • Refers to: ApexClass

ApexTestSuiteId 

  • Type: reference

  • Required: No

  • Properties: Create, Filter, Group, Sort

  • Description: The test suite to which the Apex class is assigned.

This is a relationship field.

  • Relationship name: ApexTestSuite
  • Relationship type: masterdetail
  • Refers to: ApexTestSuite

Usage 

Insert a TestSuiteMembership object using an API call to associate an Apex class with an ApexTestSuite object. (ApexTestSuite and TestSuiteMembership aren’t editable through Apex DML.) To remove the class from the test suite, delete the TestSuiteMembership object. If you delete an Apex test class or test suite, all TestSuiteMembership objects that contain that class or suite are deleted.

The following SOQL query returns the membership object that relates this Apex class to this test suite.

1SELECT Id FROM TestSuiteMembership WHERE ApexClassId = '01pD0000000Fhy9IAC'
2    AND ApexTestSuiteId = '05FD00000004CDBMA2'

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!