function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EMHDevEMHDev 

Weird code coverage results - broken in Summer 11?

I just updated a class to use the new URL class.  When I ran the test class and deployed it to production, it showed as 100% code coverage for ALL code in the IDE, although it should not have done, since it doesn't actually call all of my code.  However, in the Sandbox itself, the code coverage was way down, because it was counting blank lines and commented out code as not being covered!  So the same code is reported as 100% covered in the IDE and 83% in the sandbox from the Apex Classes link.

 

Has anyone else noticed this?  It appears to have happened today, since the summer 11 roll-out to production.  I did not have this issue when my sandbox was summer 11 and my production was spring 11, although I haven't deployed any code for a couple of weeks.

 

Salesforce, what's happening?

Here-n-nowHere-n-now

Yep same here. Started to happen after updating the IDE. The error in the log is

"Unable to locate the component file in project to display code coverage result".

 

I set up a new Eclipse, workspace, and installed force.com plug-in fresh, stil the same result.

EMHDevEMHDev

I have not updated my IDE... so that isn't it.  I don't see any errors in the log but it exceeds the size that the IDE can hold. Ran tests in sandbox, all passed, but code coverage wacky on some (but not all) classes, highlighting blank lines and commented lines as not being covered! 

 

 

 
  
 10   //optional parameters set to default
 11   private String subject = '';
 12   private String htmlBody = '';
 13  
 14   private String replyTo = '';
 15   private String plainTextBody = '';
 16   private Boolean useSignature = false;
 17   private List<Messaging.EmailFileAttachment> fileAttachments = null;
 18  
 19  
 20   //defaults to current user's first name + last name
 21   private String senderDisplayName = UserInfo.getFirstName()+' '+UserInfo.getLastName();
 22  
 23   public utlEmail(List<String> addresses) {
 24   this.toAddresses = addresses;
 25   }
 26  
 27  /* public utlEmail senderDisplayName(String val) {
 28   senderDisplayName = val;
 29   return this;
 30   }*/
sam_matsam_mat

Hi,

 

Me too getting extremely wierd results after running test classes.

Please suggest some solution to get correct test results.

 

Thanks and regards,

Sameer

 

EMHDevEMHDev

My test results are fine, it is the code coverage that is strange.  I can't suggest anything because I think something must be broken.

 

Salesforce, is anyone there?

Here-n-nowHere-n-now

Yes it's the code coverage part alone right now.  In IDE it's all 100% - we know we're not that perfect.  :)  So far I haven't seen the weired coverage (highlighting comment lines, etc.) from UI runs, but will keep an eye on it.  I did see similar problem reports on some other threads too.

mshelmanmshelman

Yes we are also seeing this and assume it is related to Summer 11.  Code coverage for some files is incorrectly reported often by %20 to 30%.  When looking at the line-by-line results for these files it can be seen that some lines are wrongly colored red (e.g., commented lines) as not having coverage.

 

To see the correct coverage for these files go to the detail page for the test class and click on "Run Tests".  This wil give a correct figure for coverage of the tested class.  However, the class list and class detail pages show the incorrect figure.  And the total coverage in the UI is incorrect.

 

It seems entirely random which classes are showing coverage inaccurately.  I have some new or revised classes that are shown correctly while others are not.

 

We did a deployment to production over the weekend and the total coverage after deployment is shown as 74%.  However the classes were deployed successfully despite the requirement to have at least 75% coverage.  Actual coverage is probably about 90%.

 

Mike

 

 

sam_matsam_mat

Hi,

 

I had issues with test classes that i wrote on monday morning (6-13-2011).

 

Issues:

Test result showed me wrong % of coverage and

comments and some covered statements too were highlighted with red color.

 

Then i deleted those test classes from org, created them again and copied my test code in them again.

And to my surprise i i am now getting correct % and correct highlighting of covered code and uncovered code.

 

Though its working this way, i am still unable to find out what could be the reason? :smileysurprised:

 

Ankit AroraAnkit Arora

Above All, yes this is a known issue. Please try to recreate the class in your organization (copy paste the code in new test class) and try to run the test class. Hopefully this will resolve the problem. I know this is bit weird workaround.

 

If still the problem is not resolved then I would suggest to log a case for it.

 

 

Thanks
Ankit Arora

 

EMHDevEMHDev

Salesforce tell me that there is a bug in the IDE and also in the async test framework.  Run Test from the Apex class detail page will work properly.  They are working on a fix.

 

Erica

Ankit AroraAnkit Arora

This is interesting. Thanks for sharing this.

 

 

Thanks
Ankit Arora

 

Here-n-nowHere-n-now

Not sure if it's related, but running test in IDE sometimes end up with a debug log that seems to be improperly truncated, even though the log isn't that long and fully viewable from the UI.

 

Looks like the aysnc test framework broke some things...  I wonder why they didn't release a new Eclipse plug-in this time.  Isn't the usual cycle to be a new one every 2 releases?

Here-n-nowHere-n-now

Another weird thing with the issue (for me at least): I'm not seeing it with another computer.  The only difference (other than being a more powerful computer) is that this one has Galileo instead of Helios, which I have the problem with 2 installations I tried.

Prafull G.Prafull G.

I am seeing another issue in running Test from "Run Test" on individual class and "Run All Test" from Apex classes. Running test from "Run Test" button showing correct code coverage, while after hitting "Run All Test" button code coverage for same class suddenly decreases by 20%.

 

any idea or help on this ?

 

Regards,

Prafull G.

EMHDevEMHDev

If you are using the async test framework for Run Test and the synchronous framework for Run All Tests, the synchronous one is the one that is correct.  The bug is in the async framework, or so I am told.  ALSO there is a bug in the IDE which reports 100% coverage.  I use Galileo and am seeing the bug.  Others see it on one machine and not another.  We will just have to use the synchronous test framework from the sandbox until they fix it.

Here-n-nowHere-n-now

Seems to have been fixed now... at least for me.  I now can see correct coverage results in my Helios installation.  Hopefully will get better for others soon. The bad news is, I just found another bug for the async framework.  I have a test class run just fine with "Run Test" (classic mode), but if I put it in the "Apex Test Execution" (new async UI), one of the testMethods fails.  Th fun never ends I guess...  I just filed a case with SFDC.

 

 

EMHDevEMHDev

I also noticed that the IDE code coverage seems to be correct now (Galileo).  I've been using the synchronous framework as salesforce had said that there was a bug in the async framework, so I haven't seen this, but I will check it out.  At least we can use the IDE/synchronous until they sort it out.

Here-n-nowHere-n-now

The issue of testMethod failing (only) in Apex Async Testing UI no longer occurs for me.  SFDC has closed the case after I confirmed the result.

EMHDevEMHDev

I noticed yesterday that it seem right aside from one method where I saw a comment and right curly brace highlighted as not being covered.  At any rate, it isn't stopping me from testing and deploying my code, which is the important thing!