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
Terry411Terry411 

Code Coverage

I'm confused and hoping somene can point me in the right direction...

 

I have 4 triggers, 1 class and 1 test class.  From the IDE, if perform the "Run Tests" I have 100% coverage on all by 1 trigger which has 97% coverage. 

 

However, i'm not able to get 1 of the triggers to upload (which has 100% coverage).  When I try the "Save to Server" option I get an error saying "Average test coverage across all Apex Classes and Triggers is 64%"  

 

What am I not seeing?  The Org also has all the Non-Profit kits installed which include a ton of managed classes I can't control.  I'd like to assume those are 100% clean.

colemabcolemab

Are you developing in a production org? 

 

When I develop in a non-production (i.e. sandbox or developer org), it lets me save with 0% code coverage.

 

Anyway, go into the web GUI and "run all tests" from the setup->develop->apex classes page.  The button will be at the top.

 

Then when your results appear, scroll down to the section where they list each class / trigger and show a % next to each item in the list (this is about half way down).  If you click on the % it will pop-up a window that will highlight the code that executed so you can see where your code stopped excuting and adjust your test logic / test data to increase the code coverage.

vishal@forcevishal@force

Firstly, are you creating test data for your test classes?

unless you create test data, your triggers and classes can fail coverage because you cant have the same data in all the orgs where you are deploying it, right?