Code coverages could be lost when executing a apex test class that takes time
Last updated 2016-07-28 ·Reference W-2308230 ·Reported By 55 users
Code coverage which has been calculated in test method executions could be lost if the test class takes a long time to complete. This will result in the "Estimate your organization's code coverage" link returning a lower value than in the actual Organization value.
Execute a long running test
To get an accurate Organization Code Coverage you can:
1) Use Meta Data API to check the accurate coverage.
You can use a recent deployment asyncId and calculate the coverage in Excel by following the steps in this Knowledge Article:
You can do this using the Web Service Connector (WSC): https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector
With this you can use the MD API and use the RunTestsResult object to loop through the results and compute the coverage through Java:
The Eclipse IDE can be used to run tests. If you run the identified test class it will return it's correct code coverage. The only caveat with the IDE is that, if you run all tests it does not provide an overall coverage for the Organization.
2) Divide the test identified long running test class into separate classes
Reported By (55)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.