Saturday, May 28, 2016

[Salesforce] The Sobject Crusade: ApexTestSuite

Source: ApexTestSuite

String '16 comes with a handy feature regarding test execution, the Test Suites.

They are a collection of tests ment to be run together organized in a single suite.

To access the test suite open your Developer Console and click Test > New Suite and enter the Suite name:



Then select all test classes you want to run in the suite:


In the Test > Suite Manager menu item you can change a suite's configuration, while in Test > New Suite Run you can choose which suites to execute.


The Settings button allows to set the maximum number of failuers allowd, so the test suite ends its run immediately after a given number of exceptions are thrown.

Clicking Run the tests are executed and presented on the Tests tab on the lower side of the Developer console:


You can query the Object easily.

Select Id, TestSuiteName From ApexTestSuite


To check for the classes involved in the suite you need to query the TestSuiteMembership that links Apex classes to the Suite, but it is another story.