Tooling Run Tests Sync
POST {{_endpoint}}/services/data/v{{version}}/tooling/runTestsSynchronous
Runs one or more methods within one or more Apex classes, using the asynchronous test execution mechanism. In the request body, you can specify test class names and IDs, suite names and IDs, the maximum number of failed tests to allow, and the test level, as comma-separated lists or as an array. You can also indicate whether to opt out of collecting code coverage information during the test run (available in API version 43.0 and later).
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
{"apexLogId":"07L4H00000SpGroUAF","codeCoverage":[{"id":"01q4H000000WjD8QAK","locationsNotCovered":[{},{}],"name":"StateTrigger","namespace":null,"numLocations":2,"numLocationsNotCovered":2,"type":"Trigger"},{"id":"01q58000000RLTyAAO","locationsNotCovered":[{},{},{}],"name":"RestrictContactByName","namespace":null,"numLocations":3,"numLocationsNotCovered":3,"type":"Trigger"},{"id":"01q58000000RLBhAAO","locationsNotCovered":[{},{},{},{},{},{}],"name":"ClosedOpportunityTrigger","namespace":null,"numLocations":6,"numLocationsNotCovered":6,"type":"Trigger"},{"id":"01p4H000009PEFIQA4","locationsNotCovered":[{},{}],"name":"PrepareSandbox","namespace":null,"numLocations":22,"numLocationsNotCovered":2,"type":"Class"}],"codeCoverageWarnings":[{"id":"01q4H000000WjD8QAK","message":"Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required","name":"StateTrigger","namespace":null},{"id":"01q58000000RLTyAAO","message":"Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required","name":"RestrictContactByName","namespace":null},{"id":"01q58000000RLBhAAO","message":"Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required","name":"ClosedOpportunityTrigger","namespace":null},{"id":"01q4H000000WjD8QAK","message":"Average test coverage across all Apex Classes and Triggers is 60%, at least 75% test coverage is required.","name":null,"namespace":""}],"failures":[],"flowCoverage":[],"flowCoverageWarnings":[],"numFailures":0,"numTestsRun":1,"successes":[{"id":"01p4H00000A0zYxQAJ","methodName":"runApexClass_should_work","name":"PrepareSandboxTest","namespace":null,"seeAllData":false,"time":1088}],"totalTime":1261}