+ Start a Discussion

Schedule Apex class to runAllTests every day


I want to develop a scheduled batch class which will run all the test classes on my org. I am aware about how to schedule a batch class and also about the JAVA code to implement this.

I am looking for some solution where I can implement this functionality using APEX itself by importing the API or similar stuff. Please help.

James LoghryJames Loghry
You could do this through an apex batch job and utilizing the Tooling API (See here: http://www.salesforce.com/us/developer/docs/api_toolingpre/api_tooling.pdf).  Note there is a library for calling the Tooling API from Apex here: https://github.com/afawcett/apex-toolingapi

lternatively, you could look at a CI or Continuous Integration solution that uses the Migration Toolkit to run the tests on a scheduled basis as well.  This would have to be hosted outside of Salesforce either on a server or Heroku, however.