1

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. – Kevin O'Hara Apr 27 '17 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? – Rajshree Jadhav Apr 27 '17 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? – Daniel Ballinger Apr 28 '17 at 1:38
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.