I am using Tooling Api to run the test in org for apex classes. Please help me with the query to callout runTests() in RestAPI.

  • 1
    Could you rephrase the question or add some details? I'm not sure what you're trying to do or where you are stuck. Apr 27, 2017 at 14:06
  • @AdrianLarson I am a begineer to tooling Api , Using ApexCodeCoverageAggregate (Tooling Api Object) I got code coverage for all Apex Class and Triggers. There are some classes which are yet to be tested so I am unable to fetch the code coverage for those classes. I tried using runTest() tooling Object, I am stuck in framing the tooling Api query. Is there any solution for this? Apr 27, 2017 at 14:18
  • @RajshreeJadhav runTests is from the SOAP API. Do you want the SOAP or REST API method to run the missing tests to get the coverage? Apr 28, 2017 at 1:38

1 Answer 1


If you want to get the CodeCoverage for an Apex class you are going to need to run the corresponding test classes so the coverage can be calculated.

With the REST API, that means you will want the /runTestsAsynchronous/ resource.

The simplest approach will be to use that resource with the testLevel of RunLocalTests. That will run all the tests in the org that don't come from managed packages.

Getting more fine grained control of which tests classes give coverage of what classes is a much more complicated question. Easier to just run all the tests.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .