I have two classes:
- ClassA.cls - was generated from a WSDL some time ago. Currently on API v22.0 and hasn't been changed recently.
- Test_ClassA.cls - calls a large number of constructors in ClassA to assist with overall app code coverage. Currently on v20.0 and hasn't been changed recently.
I've run the tests in Test_ClassA.cls via Setup > App Setup > Apex Classes > Class name > Run Test. The asynchronous test gets enqueued, run to completion and passes.
If I now return to the list of Apex Classes the Code Coverage column for this class still reports "0% (No coverage data)". Following that link shows no code coverage highlighting.
When I encountered this issue in the past I was able to "reset" the code coverage as follows:
- Use the "Clear Code Coverage" button on the Apex Classes page.
- Go to View Test History under Apex Test Execution and press "Clear Test Results"
I tried both of these steps but the class still shows no code coverage while I'm certain it previously had at least 75% coverage. Its 5000 lines long (size without comments 250,000), so it needed pretty good coverage to be included in the managed package.
Why isn't my code coverage result showing up?
If I run the Test_ClassA.cls via the Apex Api the RunTestsResult.codeCoverage comes back as null. I can see in the debug log that it did run to completion and pass all the assertions.
UPDATE: I tried creating the managed package again that includes ClassA and Test_ClassA. Coverage jumped up to 76%.