The Advanced Apex Test Tracker application is extremely simple to install and configure. It doesn’t have a pretty user interface. In fact, it doesn’t have any user interface. It’s an admin tool, and everything is handled directly in the Salesforce setup user interface.
When you install the package, you’ll have the opportunity to specify the security settings. Unless you have an unusual situation, you’ll want to install this for admins only.
(click on images to zoom)
Configuring the Scheduler
The only required installation step is to start the scheduler. You do this by using the Schedule Apex feature. Start from Settings-Develop-Apex Classes to see a list of Apex classes:
Click on the Schedule Apex button and configure the page as follows to schedule test execution:
Be sure to enable the scheduler for every day, and to set the end date out to the far future. Set the scheduled time as you wish – you’ll typically want the application to run at night. It’s a good idea to set a second scheduled task to run 12 hours offset from this one. That’s because each time the application runs it sees the results from the previous test run. After that, it runs tests that haven’t run in at least 23 hours.
When a test fails for the first time, or after previously passing, a new DPTR.CI_TestResult__c object is created with a null ClassID__c field value. The default “Notify on error record” workflow shows you how to detect this condition. By default it is active and invokes an Email alert.
By default the Email alert notifies the person who started the Scheduled Apex job, but you can edit it to notify whoever you wish:
And yes, feel free to modify the Email template used for the alert.
Tracking Tests Manually
Don’t want to wait 24 hours until evaluating tests? You can run the application at any time by opening the developer console and using the Debug – Open Execute Anonymous Window, and entering the command
and then clicking Execute.
That’s all there is to it. Remember, that each time you application runs, it picks up the results of the previous set of test results. It also sees the results of any tests you run manually using the Setup – Develop – Apex Test Execution window. If it sees a test that is failing for the first time, or failing after previously passing, the workflow will trigger and anyone you’ve specified will be notified.