How can I check the cumulative line by line code coverage of an Apex class that is included in a managed package?
I have a dev org where I create a managed package. It has already gone through a number of iterations/releases. One of the classes that was generated by WSDL2Apex was significantly updated in the current release which caused the code coverage to drop.
I’d like to quickly check which lines aren’t being tested in this class.
To do this I:
- Pressed the Clear Code Coverage button on the Apex Classes page
- Pressed the Clear Test Results button on the View Test History page
- Pressed the Run All Tests button on the Apex Classes page and waited for the tests to complete.
- Clicked the percentage that appeared in the Code Coverage column. Currently 73% in the screenshot below.
The resulting URL was:
But the page was missing any content beyond the navigation chrome.
My first thought was that this used to work and that something has broken in Summer 13. I raised case 09533205 with support, but they insisted this works as designed and you can’t see code coverage for an Apex class that is in a managed package. Even if you are in the packaging org that defines the class.
This does seem to be how it works, as the code coverage link only shows content for Apex classes that aren’t in the managed package.
Updated: I have found alternative ways to check the code coverage.
- The developer console can see the same information, but it has a tendency to become unresponsive/hang for me.
- I can also get code coverage data via the API, but I’d prefer not to create my own code coverage viewer.
- I can get code coverage for an individual test class by running it in Eclipse. This doesn’t show the cumulative result of all the test cases.
So now the question becomes:
Should I be able to use the code coverage link for a managed package Apex Class in the packaging Org that defines it?
I was fairly certain this used to work before Summer 13. Salesforce support disagreed and said it worked as designed before closing the case.
This is listed as a Known Issue: https://success.salesforce.com/issues_view?id=a1p30000000SzHiAAK
Unfortunately, its Status is No Fix: Salesforce Engineering Management determined that a fix for the issue is not possible.