3

In an org with many classes, controllers and triggers, is there a way to quickly identify where code coverage is low? Run all tests shows me where there are tests that are failing, but there doesn't appear to be a place where, after running them, the % covered per class/controller/trigger is displayed.

Force.com ApexTestRunner in Eclipse (appears to) display the code coverage provided by the test(s) you just ran (say 8% coverage on apexWhizBangLeadScorer, from running apexCampaignProcessTest), while there may be another test class that provides 97% coverage for that same apexWhizBangLeadScorer class.

I can run 'SELECT Id, NumLinesUncovered FROM ApexCodeCoverageAggregate' in Developer Console (and have had to, when I get the dreaded "0% code coverage" error when trying to deploy Change Sets), but what I really want are the NAMES of the classes, not a list of IDs (which are the Ids of the ApexCodeCoverageAggregate records themselves, not of the classes they draw from).

1 Answer 1

2

Run all test classes using web browser. Then open developer console. There will be an "Overall Code Coverage" section. There it will list down all classes and corresponding coverages. If you sort by Percent, you can easily find the ones with least coverage

2
  • You can also use the Force.com IDE Test Runner. Run All Tests in the IDE, go grab lunch, and when you come back, you'll have all of your code overage listed.
    – sfdcfox
    Commented May 13, 2015 at 16:24
  • Okay, great! I hadn't made the connection between 'Run All Tests' and the Code Coverage numbers before now. Commented May 13, 2015 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .