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
BhatiaBhatia 

Trigger is not deploying to Production Org although it has 100% code coverage in Sandbox Org

Showing Error:

 

Its test coverage is 0% , it should be at least 1%.

 

Any help will be appreciated

 

Thanks

bob_buzzardbob_buzzard
A few things to check:

Are you delpoying the test class along with the trigger?
Does the unit test pick up live data that causes a problem?
Is the unit test throwing an exception?
MiddhaMiddha

This test class does'nt seems to be calling your trigger. Can you elaborate what your trigger is doing so that we can help you with the test class.

Shashikant SharmaShashikant Sharma

Could you please provide trigger and test class both, it would be very helpful. It might be posible that there is some data dependency , object record or custom setting record  is used from org so it is showing 100% on sandbox but bot on prod. 

bob_buzzardbob_buzzard

Unit tests can hit problems if the data that is worked on isn't self-contained.  For example, if the class that you are testing runs a query that pulls in the existing live data as well as the test data that you have created, you may find yourself breaching test context limits.

 

That said, I'd expect to see an exception if this was the case - are you seeing that?

 

Is the test class that you are deploying definitely the one that is testing the trigger (i.e. its not covered by some knock-on effect from another test class)?