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
Michael DsozaMichael Dsoza 

Trigger code coverage showing 0% while deployment

Hi, 
I have one trigger (before update) & its test class. When I run its test class from Apex Test Execution (In Production) then I get trigger code coverage as 70%. But when I try to deploy the same trigger with its test class (same as Production) from UAT to Production then all test method passes but I get code coverage as 0%.
Is their anything in settings which restrict us to count code coverage while deploying ??
 
pconpcon
Can you please provide the test class you are running in your sandbox?  Are you using SeeAllData?  What version of the API are the test class for?  When you do the deployment, are you including your test class for that deployment as well?

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
Michael DsozaMichael Dsoza
Hi pcon, Thanks for looking into this.
Yes, I am running a test class with seeAllData=true. Also, I checked with the queries & it is giving me expected data on Production as well as Sandbox environment. 
Earlier I was using higher api version in Sandbox & Also, I decresed the api version to equal / lower to production api version but still did not find any luck there.
Yes offcourse, while deploying trigger, I am adding its corresponding test class.
Since it is working fine in Sandbox & giving me 70% of code coverage (as we all know 1% is enough to deploy the trigger) But I don't know why it gets stuck in deployment.
Is their any other workaround that I am missing ??? I also checked, status of trigger is active while deploying. And Trigger's test method passes successfully. But at the end it gives me Code coverage Error. I tried to debug but deployment debug is not possible as I know. 
Since the entire Trigger code is quite huge so I need to simplify to make it understand. Meanwhile Can you please help me any other ways/tricks/ideas that I need to look ??
Thanks.
 
pconpcon
How are you doing the deployment?
Michael DsozaMichael Dsoza
Hi pcon,
I am using Change Set for deployment.
Thanks
pconpcon
Sorry it's taken me a couple days to respond. To be honest without logging into your org and actually seeing the failure, I'm not really sure where to move forward.  And, no offense, I don't want the responsibility of logging into your org.  If you keep getting issues, it might be worth trying to file a support case.