Create and Execute a Test Suite in Salesforce

A test suite is a collection of Apex test classes that you run together. For example, create a suite of tests that you run every time you prepare for a deployment or Salesforce releases a new version. Set up a test suite in the Developer Console to define a set of test classes that you execute together regularly.

You now have two test classes in your org. These two classes aren’t related, but let’s pretend for the moment that they are. Assume that there are situations when you want to run these two test classes but don’t want to run all the tests in your org. Create a test suite that contains both classes, and then execute the tests in the suite.

To create a Test Suite, use the below steps

1. Go to the Developer Console, select Test --> New Suite.


2. Enter any name for the suite name, and then click OK.


3. Select the test classes to add it to the Suite by clicking >.

4. Click Save.



To run the test suite, use the below steps

1. Select Test --> New Suite Run.


2. Select the Suite, and then click > to move Suite to the Selected Test Suites column.

3. Click Run Suites.


On the Tests tab, monitor the status of your tests as they’re running.

No comments:

Post a Comment