In this blog I will discuss one of my personal highlights of the Salesforce Spring ’16 Release: Test Suites.
Writing and running Apex unit tests is part of my daily work as a Salesforce developer. Especially when we are working toward the end of a sprint, our team is running unit tests all day. Since we usually deploy our new functionalities to production once the sprint has ended, we are running multiple tests during every test run. Manually selecting the tests to run can take up a lot of time, but now there’s a solution: Test Suites.
With the Spring ’16 release you can now select multiple tests and save them in a Test Suite. Rather than selecting all the relevant classes each time you start a test run, you can simply run one or more test suites. This saves a lot of time. Time that can be spent better by serving our customers.
So, how does this work?
You can create and run Test Suites using either the Developer Console or the API (SOAP/REST/Tooling). This means that Test Suites will (probably) also be available in the IDE of your choice soon. For now I will focus on the Developer Console. For more information about creating and running Test Suites using the API, please see the Spring ’16 release notes.
Create a Test Suite
To create a Test Suite, open the Developer Console and go to Test > New Suite:
Next, enter a name for the new Test Suite:
Your Test Suite will open. Here you can select the test classes you want to add to the suite. To add a test class, simply select it and press the arrow pointing to the right:
Click Save to save your test suite.
Running your Test Suites
To run the Test Suite, go to Test > New Suite Run in the Developer Console:
This will open an overview of all your Suites. Select the Suites to run and click the arrow pointing to the right to include them in your testrun:
Click “Run Suites” to run your test suites.
Managing your Test Suites
Of course there is also the possibility to manage your Test Suites. To do this, go to Test > Suite Manager in the Developer Console:
This will open the Suite Manager:
You can change the contents of a Test Suite by clicking “Edit Suite”. This will open the dialog for adding or removing test classes. Also, you can add (New Suite) or delete (Delete Suite) Test Suites.
Test Suites are generally available in both Lightning Experience and Salesforce Classic.