You need to sign in to do that
Don't have an account?

Bug - Salesforce Test Coverage System
Test coverage in my package is failing! It seems to be failing on blank lines, closing brackets, random lines in queries and comments. Causing my code coverage to be half (or less) than what it should be!
None of this should be scanned.
Anyone else getting this problem?
I've been having exactly opposite problem since yesterday. I am using MyEclipse, and it tells me I have 100% code coverage, while in reality the code coverage is 0% for many classes.
On a better note - when I test the classes through SF user interface, it shows true coverage.
Any ideas what's going on?
I'm talking about the Salesforce UI as well.
When I view the coverage, it highlights lines that aren't even an issue.
We're seeing that in our ant build and in the eclipse IDE... would of been so great if it was actually 100% ;)
I am facing a bit same issue, comments in my code are coming under code coverage. Closing brackets etc...
Am facing this after the latest release. I would suggest you if you can log a case over this, and let me know what solution salesforce say.
Already filed a case. Just seeing if anyone else was getting the same issue.
I ended up deleting the class and re-creating it (copy and pasting the code back in) and it worked absolutely fine. Would be much more of an issue if the package was in a release state but I have noticed that the issue had spread to other classes, so I'm not sure that this would be a productive use for my time.
I hope that a fix is produced ASAP.
Do you think changing the API version to 22 would fix it?
Don't understand why it should. Salesforce should cover every active API version and if anything, older API versions should work better as they have already been built and worked previously. v22.0 has the least chance of working in my opinion.
Yeah, I was just trying to think what would of changed by deleting and recreating the class and the api version would have been updated would it not?
I'm running into the same situation. Using both the metadata api and the eclipse IDE we're always seeing 100% test coverage. For some the CodeCoverageResult's numLocationsNotCovered is always return 0.
I've tried different API versions and it made no difference.
I have a case with premier support, it's at Tier 2 right now. They had me walk them through it with screen sharing, said going to investigate. Maybe this is some new bug from the summer release. In the meantime, I am using SF UI to run all tests.
But I'm using the Salesforce UI for testing!
Hey everyone,
Salesforce is aware of the issue and we are working on resolving it. Until the issue is resolved, please use synchronous run tests (the Run All Tests button on the Apex Class List page or the Run Test button on the Apex Class Detail page) for accurate testing results.
We apologize for the inconvinience. This is currently our team's top priority.
Thanks.
And what about the problem I've been having?
Does the Salesforce team has a fix to it Yet? I am still seeing the same problem when doing the Test Runs from Builder??
I am thinking of opening up a case with them
Thanks.
If you are referring to the bug that I had mentioned in my original post (rather than everyone elses) then they are fixing it as we speak.
As far as the bug showing 100% code coverage in MyEclipse - they fixed it last week. It was a problem caused by Summer release of SF.
When I run test clas individually it shows different code coverage as 60%, but when see the codecoverage of that particular class, I see 39%. Dont know whats wrong......
Hope salesforce is looking into it.
Regards,
Lakshman
That sounds normal to me.
If you are running a test, it could use several classes and will calculate the average coverage, whilst your class might be a lot lower than you would expect.
No its not like that. Following are details:
Code Coverage Total %39
Class: SendForRFP. Coverage: 60%
When I view the class it shows me 39% code coverage.
One more scenario for a class is:
Code Coverage Total %70
Class: OppsProd. Coverage: 70%
Actual coverage is 50%
Do you have any idea why I am getting this?
I think this is a bug as earlier(before summer 11 release) my coverage was 60% and 70% respectively. Now it has drastically reduced.
Regards,
Lakshman
As previously mentioned, it is a good idea to clear all the test executions before you run any tests.
Has that worked for you?
Let me confirm, this is how I clear test execution-
App Setup->Develop->Apex Test Execution->View Test History->Clear Test Results
Am I right? If there is other way then please tell as I am getting 0% code coverage now after rerunning the test sync way. :(
Regards,
Lakshman
Oh! it seems this is a bug and salesforce needs to work on it or atleast remove Run Test from test classes page. Now I am getting the desired code coverage after clearing History and then re-running the class from Apex Test Execution.
Thanks admintrmp!
Regards,
Lakshman
If you clear the results, and test your class invidually as you were before, you will get the newly revised results up. It's annoying I know.
Wow, this is bad. Clearing the results worked for me as well.
Well that caused me to waste some time. After clearing my prior test runs (https://xyz.salesforce.com/07M, where xyz is your Salesforce server) the code coverage jumped from from 61% to 91%.
Clear all test results and try........
http://salesforcetipsntricks.blogspot.in/2012/03/strange-issue-with-code-coverage-in.html
https://help.salesforce.com/apex/HTViewSolution?urlname=Code-coverage-steps-and-considerations-prior-to-deployments&language=en_US
Basically It's a clear of all test cache, re-compile of all classes and then re-running all tests. You'll need a fresh cup of coffee. But it does seem to work. YMMV.