You need to sign in to do that
Don't have an account?

Running Apex Test Async with soap/rest tooling api
Hi,
I'm trying to figure out how to get the results from running test classes asynchrous using the tooling api. It looks like it returns a AsyncApexJob id, but if there a lots of apex tests the process could take a while to complete. How would you know when the job is finished? Would you have to continiously submit get request to find a completion date, or is it possible to create some sort of listener ( without the streaming API ) to listen for when the tests complete?
I'm trying to figure out how to get the results from running test classes asynchrous using the tooling api. It looks like it returns a AsyncApexJob id, but if there a lots of apex tests the process could take a while to complete. How would you know when the job is finished? Would you have to continiously submit get request to find a completion date, or is it possible to create some sort of listener ( without the streaming API ) to listen for when the tests complete?
You can do it with ApexTestQueueItem. I am not sure what exactly you are expecting to do but this might work.
- You can run tests asynchronously using ApexTestQueueItem and ApexTestResult from the apex Class as shown below.
- Invoke it from the Apex Scheduler to check the status and alter user.
Refer this link https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_unit_tests_running.htm