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
Alastair1988Alastair1988 

Apex error when uploading change set to live environment?

We are working on small Salesforce Enhancement Project. We are launching our department naming conventions for Salesforce and also introducing an Advanced Opportunity Search feature.

I am not a Salesforce Apex developer but I have managed to implement the apex pages and classes for Advanced Opportunity Search on our SandBox environment and it is working fine but when I try to upload to the live environment using Change Set of Salesforce, then it is not going through and producing following message.

“Average test coverage across all Apex Classes and Triggers is 65%, at least 75% test coverage is required.”

Can anyone identify this error and let me knoe the likely causes?

Rahul_sgRahul_sg
This occurs when the overall code coverage of an org is below 75%. For every apex component(e.g. class,trigger) that you create you need to create corresponding test method class. This test method verifies whether a particular piece of code is working properly or not. In your org it seems test methods are not written properly or not @all created for few apex components. You will have to add apex test methods in order to push your changes to prod.
k_bentsenk_bentsen

You need to write test classes for your page controller classes. The idea behind this is that the test class will help you catch run-time and logic errors before you deploy to a live environment. Just because you can "compile" or save an Apex class or trigger in your sandbox does not mean it is error free.

 

A good guide to get you started can be found here:

 

http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods