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
Amith RaoAmith Rao 

2.Q If the Trigger does not have the class or method, Does it really required to test the coverage code for Trigger?

Best Answer chosen by Amith Rao
HARSHIL U PARIKHHARSHIL U PARIKH
You will run into one of the following situation commenly.

1) Have a trigger which doesn't do anything (No code inside, and no helper class call etc.)
- You still need a 1% of code coverage in order to deploy this trigger. Why not 75%? Because you may have 100 other individual triggers which are deployed in past with 100% code coverage for each and so it allows you to have 1% for this new trigger. Because your average is being taken cared, which is 75%

2) You have a Trigger which has a helper class and this is the first trigger you are deploying
- In this case you need to have 75% (at least) code coverage prior to deploy.

3) You have a trigger which doesn't have helper class but all the code is within inside the trigger
- In this case you need to have 75% (at least) code coverage prior to deploy.

I agree with the people above for 1% minimum. But that only comes into picture when you have other triggers deployed with an average of way more than 75% of coverage.

Hope it helps!

All Answers

Virendra ChouhanVirendra Chouhan
Yes it requored at least 1% code coverage to deploy. 
pranab khatuapranab khatua
If you don't have any trigger on any object then you don't require any test class on that object. If you have a Trigger but there is not any helper class or method then you have to write a test class with minimum 1% code coverage.

Please choose best answer if you help it.
Suraj TripathiSuraj Tripathi
Hi Amith,

You have to get at least 1% Code Coverage to deploy your code to the production.

Every trigger must have some test coverage.
Triggers are the only logical blocks that specifically require >0% coverage.  

Kindly mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Regards
Suraj
HARSHIL U PARIKHHARSHIL U PARIKH
You will run into one of the following situation commenly.

1) Have a trigger which doesn't do anything (No code inside, and no helper class call etc.)
- You still need a 1% of code coverage in order to deploy this trigger. Why not 75%? Because you may have 100 other individual triggers which are deployed in past with 100% code coverage for each and so it allows you to have 1% for this new trigger. Because your average is being taken cared, which is 75%

2) You have a Trigger which has a helper class and this is the first trigger you are deploying
- In this case you need to have 75% (at least) code coverage prior to deploy.

3) You have a trigger which doesn't have helper class but all the code is within inside the trigger
- In this case you need to have 75% (at least) code coverage prior to deploy.

I agree with the people above for 1% minimum. But that only comes into picture when you have other triggers deployed with an average of way more than 75% of coverage.

Hope it helps!
This was selected as the best answer