Test Suites in Salesforce

Running specific set of test classes is a complex one and it’s hard to run them one by one. Salesforce has come up with new feature called Test Suite. Test Suite acts as container, and using this feature you can add a set of test classes and run them together. You can add up to a maximum of 200 test classes per TestSuite.

What is Test Suite? 

Running specific set of test classes is a complex one and it’s hard to run them one by one. Salesforce has come up with new feature called Test Suite. Test Suite acts as container, and using this feature you can add a set of test classes and run them together. You can add up to a maximum of 200 test classes per TestSuite.

Availability? 

From the beginning of Spring 16 release orgs.

This feature is accessible via “Developer Console” in both Salesforce Classic and Lightning Experience.

How to Create New Suite? 

Step 1: 

Go to Developer Console > Select Test > New Suite.

test suites salesforce

Step 2:  

Enter a name for your test suite and click OK.

test suites salesforce

Step 3: 

Select and add the list of classes you are going to frequently run and click Save.

test suites salesforce

What is New Suite Run? 

New Suite Run allows you to run TestSuites (Which contain list of classes).

Step 1: 

To run one or more TestSuite,  go to Developer Console > Select Test > New Suite Run.

test suites salesforce

Step 2: 

Select the Test Suites from the Available Test Suites, and then select and Run Suites.

test suites salesforce

Specify Run Parameters: 

You can specify run parameter on Settings before running the test Suites.  This functionality allows you to stop your test run from executing new tests after a given number of tests fail. You can set the failure threshold to an integer value from 0 to 1,000,000. This integer value sets the maximum number allowable test failures. A value of 0 causes the test run to stop if any failure occurs. A value of 1 causes the test run to stop after the second failure, and so on.

test suites salesforce

How to use Suite Manager? 

Suite Manager allows you to do the following,

  1. Create a New Suite.
  2. Edit a Suite. (Adding and removing Classes).
  3. Delete a Suite.

To navigate to Suite Manager, go the Developer Console [Symbol] Select Test > Suite Manager.

test suites salesforce

Here is the suite manager view.

test suites salesforce

How to query list of Test Suites and Test Suite Members? 

ApexTestSuite: To know the list of available Test Suites.

Select Id, Name FROM ApexTestSuite

TestSuiteMembership: Represents a class in an ApexTestSuite.

SELECT Id FROM TestSuiteMembership WHERE ApexTestSuiteId = ’05FD00000004CDBMA2′

Reference: 

https://releasenotes.docs.salesforce.com/en-us/spring16/release-notes/rn_apex_tests.htm

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.