---
schema_version: "1"
id: 3d6c3d3dc4d60903a13ec907606891511e2539a74a0e15c11dc56738bf265506
title: TestSuiteMembership
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_tooling/tooling_api_objects_testsuitemembership.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_testsuitemembership.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 63fb13fc307924d3bfc427ea18ad04ed7d9d70a7b0d262e827f0e3ce4623612e
description: Associates an Apex class with an ApexTestSuite. Available in Tooling API version 36.0 and later.
---
# TestSuiteMembership

Associates an Apex class with an ApexTestSuite. Available in Tooling API version 36.0 and later.

## Supported SOAP API Calls

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

## Supported REST API HTTP Methods

Query, GET, POST, PATCH, DELETE

## Fields

| Field Name | Description |
| --- | --- |
| ApexClassId | 
Type

reference

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

Lookup

Refers To

ApexClass



 |
| ApexTestSuiteId | 

Type

reference

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

Lookup

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.

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