My production org had code coverage of 85% but suddenly dropped to 55%. We have written test for every class and we are up to 63%. Anyone else have an idea of why this dramatic drop occurred and why it has become so hard to raise the coverage back up?
1Are you saying all tests are running succesfully ? My guess is some validation rule / newly required field is making existing tests fail.– Samuel De RyckeJan 23, 2014 at 16:42
1I experienced similar things before, but I don't have an answer. Are you cleaning test results? Do you have many non/covered classes?– zdropicJan 23, 2014 at 16:45
Clear your test history and then rerun and its some known issue.Not getting link to official doc but clearing test history should resolve– Mohith ShrivastavaJan 23, 2014 at 16:47
Yes all test are passing in the test execution. Also yes we have taken all those measures of clearing out the test and compiling all classes. Apparently there has been a change in how the calculate code coverage. If a class has zero coverage it counts every line regardless of its purpose as not covered. So we have worked to get every class we have covered to at least 75% covered. Still not sure why we can not get it up over 63%. Any ideas?– user5457Jan 23, 2014 at 19:52
You can see what code is covered, and by what tests in the developer console.
If you go to Your name > Developer Console, to launch it, you can then execute all tests (unless you are already confident test results are already up to date.)
Once you have done this, in the bottom right corner there will be a list of each Apex class in your org, with it's coverage..
Double clicking a file name will load the file into the viewpane and should colourise it by blue/red for lines covered and not covered. In the top left of this pane is a drop down in which you can select "All tests" or the specific test that touched the file to see how it's covering it.
Using this you should be able to determine what is not covered, and/or what your tests are actually doing (if they are still passing) and get coverage back up!