The compileAndTest() call contains a request, CompileAndTestRequest with information about the Apex to be compiled. The request also contains this object which specifies information about the Apex to be tested. You can specify the same or different classes to be tested as being compiled. Since triggers cannot be tested directly, they are not included in this object. Instead, you must specify a class that calls the trigger.
If the request is sent in a production organization, this request is ignored and all unit tests defined for your organization are run.
A CompileAndTestRequest object has the following properties:
| Name | Type | Description |
|---|---|---|
| allTests | boolean* | If allTests is True, all unit tests defined for your organization are run. |
| classes | string*[] | An array of one or more objects. |
| namespace | string | If specified, the namespace that contains the unit tests to be run. Do not use this property if you specify allTests as true. Also, if you execute compileAndTest() in a production organization, this property is ignored, and all unit tests defined for the organization are run. |
| packages | string*[] | Do not use after version 10.0. For earlier, unsupported releases, the content of the package to be tested. |
* Link goes to the Web Services API Developer's Guide.