Sunday, 30 January 2011

Apex Test Coverage

I've been taking a look at some Spring 11 features this week, via a pre-release org, particularly the Apex Test Framework, which sadly is a pilot program. While most of the focus of the release notes/help etc is around the ability to select groups of classes to test and to execute those test in the background, there's an additional feature that grabbed my attention.

Once I'd run my unit tests, I browsed to the Apex Classes setup page and found a new column in the class list  which is going to save me time on every project I work on - code coverage:


During the development phase of a project, the first thing I do every morning is run all unit tests and check the output to see if I'm missing any coverage.  If there's been a lot of development taking place, I'll repeat this many times during the course of a day.  Sometimes I'll scribble the names of classes that need attention or print out the results page, but it all feels a bit clunky.  Now all I need to do is to execute the tests once (which can be automated - there's a post explaining this in the pipeline) and browse to the Apex Classes page each time I want to see the coverage percentages.

Even better - this looks to be available outside of the pilot program functionality - I've just checked my free force sandbox that has been upgraded to the Spring 11 release and the code coverage figures are there!

No comments:

Post a comment