function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kpetersonkpeterson 

Scheduling Apex Tests

We have people making changes in production rather than sandboxes a majority of the time (can't change this) and they aren't always aware of what the apex is tied to.  I know there is the "Run All Tests" button in the setup interface but that really bogs down the browser with everything it returns and isn't very usable for them.  Is there a way to maybe schedule tests and have the results emailed to me so I can be aware of anything that broke recently?


paul-lmipaul-lmi
i do this, but in more real time than that.  what i do is use the outbound email service to do a debug by email type setup.

salesforce natively supports emailing apex code errors to an admin, but i can only seem to get this to work with triggers.

if you properly use try...catch statements, implementing this would be as simple as creating a small class for the singleemail, and then passing the data you want to it as part of your catch statement.
kpetersonkpeterson
Apex errors do get emailed to me when they occur.  What do you mean by "what i do is use the outbound email service to do a debug by email type setup", that confused me.  My goal is to schedule all of my Apex tests and have the results emailed to me so I can hopefully fix problems that exist before they occur for people actually working.
paul-lmipaul-lmi
ok, i see what you mean.  you're probably looking at something custom via teh api to do this then.  salesforce is not very keen/open/supportive of anything that's both scheduled and all-encompassing.

they run all of your tests before they do an update, but i think that's the extent of it.