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
Mathew Thomas 29Mathew Thomas 29 

I have a deployment of a trigger from sandbox to production. I do not have a class associated with this trigger but I get a code coverage error what am I f doing wrong

Best Answer chosen by Mathew Thomas 29
VinayVinay (Salesforce Developers) 
Hi Mathew,

Take a look at below references that has test class example along with details on how to implement test class.

https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro
https://jayakrishnasfdc.wordpress.com/2021/01/02/salesforce-apex-test-class-with-an-example-annotations-best-practices-of-test-class/
https://www.sfdcpoint.com/salesforce/test-class-with-example-salesforce/

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Mathew,

If you are deploying any trigger in Production, then you must write a test class for that trigger with no Test failure and more than 75% code coverage.

https://help.salesforce.com/articleView?id=000315564&type=1&mode=1

Thanks,
Mathew Thomas 29Mathew Thomas 29
@vinay I am new at development could you show me how should we create a test class?
VinayVinay (Salesforce Developers) 
Hi Mathew,

Take a look at below references that has test class example along with details on how to implement test class.

https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro
https://jayakrishnasfdc.wordpress.com/2021/01/02/salesforce-apex-test-class-with-an-example-annotations-best-practices-of-test-class/
https://www.sfdcpoint.com/salesforce/test-class-with-example-salesforce/

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
This was selected as the best answer