Yesterday we had 10-11 records and today just 2. This is what I did:

Check recycle bin and using All Data

Check Bulk API delete capable processes and users

Check connected apps.

DataLoader.io SSO doesnt work so couldnt check there

Tried putting a trace on ApexTestRunResult but you cant do that on tooling api objects

Checked the audit logs, and nothing there.

Does Salesforce purge the data in ApexTestRunResult by itself? I couldnt find any documentation.

WHat else can I do to track down what happened? Does salesforce purge this data themselves?


They most certainly do get automatically deleted. If they weren't purged periodically they would eventually add up to a significant number of records.

Looking in the Dev org I'm currently connected to I can see ApexTestRunResult records dating back to 14-Jan-20 1:36:57 AM. So about a month ago.

Note that all the ApexTestRunResult records are parented by an AsyncApexJob via the AsyncApexJobId field. If anything were to delete the AsyncApexJob record the corresponding test run result would also be deleted.

There is a doc that indicates Salesforce automatically deletes these AsyncApexJob records:

Completed AsyncApexJob records are automatically purge by salesforce after 7 days.

Oddly, that timeframe seems to contradict the currently month of examples in my dev org.

It is possible that someone used the System.purgeOldAsyncJobs(dt); method to explicitly remove the jobs before Salesforce automatically purged them.

Another possibility, perhaps more likely, is the Clear Test Data button from the Apex Test Execution history page or the equivalent from the Developer Console Test > Clear Test Data option. Those immediately remove the ApexTestRunResult records.

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.