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
camforcecamforce 

Chatter classes and triggers dragging down average test coverage

I feel I must be missing something here and please correct me if I am.

 

I am trying to deploy a custom apex trigger to Production using Eclipse. It has 100% coverage as well as it's test method which is in a seperate class. But when I go to deploy, Eclipse tells me that the average test coverage of all classes/triggers is only 72%. This seems to be due to a lot of Chatter related classes and triggers that are listed with between 30% and 90% coverage and this is stopping my deployment from going through.

 

This is my first attempt at APEX and I really don't feel I would be capable of writing test methods to get Chatter related test coverage up.

 

Is it at all possible to disregard these extra Chatter classes from being accounted for when I am trying to deploy? I don't even understand why they are there in the first place?

 

 

Somewhat related to a post I made yesterday in another thread:

 

 

http://community.salesforce.com/t5/Apex-Code-Development/URGENT-Test-coverage-of-selected-Apex-Trigger-is-0-at-least-1/td-p/203900

 

 

Any help on this would be much appreciated.

 

Cheers.

camforcecamforce

So I made a temporary change to the ChatterConnector class to limit the number of rows outputting from one of the queries and it stopped the error happening. After doing this I am no longer getting a test coverage error which implies that this was causing the whole problem.

 

I'm now stuck in the same boat as a lot of people and struggling to get my trigger to get any coverage on deployment. I am deploying it at the same time as my test class, both of which had 100% coverage in Eclipse, but the trigger is just not getting any test coverage whereas the class is deploying at 100% coverage. I have looked over the objects and fields in the test method and all exist in the production that I am deploying to. I tried deploying the class first and then the trigger after and it makes no difference. I included a try {}catch{} to try to pick up any Dml exceptions as suggested in another thread but that also made no difference.

 

Anyone have any ideas what the problem might be?

camforcecamforce

OK, I finally got my trigger to deploy to production. Phew!

 

In the end it turns out that I was using the wrong trigger operation. I was performing a "before update" when it seems it should have been an "after update".

 

Very silly thing.