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
prashant1985prashant1985 

Code Coverage

Hi,

 

Code coverage issue.

 

when i run all test  from setup-->develop-->apex classes  its show 76% code coverage.

but when i go to make new package.

I add all apex class and  pages, tabs,buttons in package.

and when i go for upload this package its show error you can not upload this package code coverage is 12%

 

so please suggest why this happen its show 76% code coverage when i run all test from apex class.

 

so give solution.

 

Thanks

Prashant

Temple SutfinTemple Sutfin

If you select "Run All Tests" it is running ALL of your test classes (not just the package you are working on) and giving you the complete percentage of code coverage for ALL your test classes.

 

The package you want to upload is a seperate entity from the "Run All Tests" code coverage.

 

You will need to boost the code coverage on your package so that when it is calculated alone and with all the other tests being run it is over 75%.

 

If you want to upload the current package, you need to boost the code coverage from 12%.

Like This:

Currently in your ORG:     (what is being evaluated when you "run all tests")

One Class = 85%

Another Class 76 %

A Third Class = 99%

 

What you are trying to deploy:

New Class = 12%

 

Try to get the package to 100% before you upload it.

 

 

 

Jeff MayJeff May

and another useful tidbit is that the 75% coverage rule is the percentage of coverage of all non-managed Apex -- not each Apex class.  So a large class with lower coverage is difficult to overcome by many small packages with 100% coverage.