Newer Version Available
compileAndTest()
Syntax
Usage
Use this call to both compile and test the Apex you specify with a single call. Production organizations (not a Developer Edition or Sandbox Edition) must use this call instead of compileClasses() or compileTriggers().
This call supports the DebuggingHeader and the SessionHeader.
All specified tests must pass, otherwise data is not saved to the database. If this call is invoked in a production organization, the RunTestsRequest property of the CompileAndTestRequest is ignored, and all unit tests defined in the organization are run and must pass.
Sample Code—Java
Note that the following example sets checkOnly to true so that this class is compiled and tested, but the classes are not saved to the database.
Arguments
| Name | Type | Description |
|---|---|---|
| request | CompileAndTestRequest | A request that includes the Apex and the values for any fields that need to be set for this request. |