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
plapla 

Trigger deployment error

Hello,

 

I'm having problem deploying my new trigger from sandbox to production. When I attempt to deploy the trigger, I get an error message that says "Average all Apex class and trigger test coverage is 69%, at least 75% test coverage is required". How can I bypass this error for deploying the new trigger. Please advise.

 

Thanks

Paul

 

VaasuVaasu
You cant bypass this error. You have to write test class and improve the test coverage up to 75%.
Team WorksTeam Works

To bypass the error write the test for both negative and positive scenarios, for more than one use, for single record and bulk records..

pooja@magichorse.compooja@magichorse.com
Create one apex class, and create on public static function and write below line for more than 1000 times.

String s;
s='';//repeat this line for more than 1000 times (you can increase if you need more coverage)

Then create test class for this class and add this both class to your trigger change set. This is a temporary solution.

plapla

Hello,

 

What do I have to write for the test class of the example class you mentioned  in previous message? Please advise

 

Thanks

Paul

 

Team WorksTeam Works

Hi,

 

Kindly Post the trigger code...

Cheers!

pooja@magichorse.compooja@magichorse.com

Below is Sample class to increase code coverage.

 

Public class ImproveCodeCoverage {
    Public static void StartTestCode(){
      String p='';
      p='';
      p='';
      ......... //repeat as many time as you want..more line will cover more coverage
    }
}

 

below is the test class for above apex class

 

@isTest 
private class Test_AccountGivingSummary   {
     static testMethod void MyTest() {
        ImproveCodeCoverage.StartTestCode();   
     }
}

 This will improve your overall coverage, so add both class to your change set.

plapla

Thank you for the sample codes.

 

Paul