You need to sign in to do that
Don't have an account?
Rich Tolocka
Salesforce gives inconsistent answers on code test coverage
Hello-
Was hoping someone could help me. Currently, I'm unable to deploy code as Salesforce reports insufficient code coverage.
Specifically, I have a trigger called 'ResourceTrigger'. The Developer's console reports 87% code coverage on this class. Picture below.
But when I attempt to deploy (or validate the deployment of the trigger), the system prevents me from deploying, saying I have zero percent coverage for ResourceTrigger. This is contradictory.
Any ideas or help is appreciated.
Was hoping someone could help me. Currently, I'm unable to deploy code as Salesforce reports insufficient code coverage.
Specifically, I have a trigger called 'ResourceTrigger'. The Developer's console reports 87% code coverage on this class. Picture below.
But when I attempt to deploy (or validate the deployment of the trigger), the system prevents me from deploying, saying I have zero percent coverage for ResourceTrigger. This is contradictory.
Any ideas or help is appreciated.
Possibly different data and configurations in your production environment are lowering the coverage. The link below has a good explanation. Hope this helps!
https://success.salesforce.com/answers?id=90630000000hHVZAA2
If SeeAllData = true then Your test methods depend on data in the organization, so you probably have a more robust data set in Sandbox than in Production. A best practice is to create all your test data within your test method,
All of the data used in the test is created within the ResourceTrigger test itself. This is a brand new class (Resource) and therefore there is no data in our production instance that could possibly be used to test this class other than what I've created within the test itself, as test data.
I remain very confused about how such variant numbers (0% vs 87%) could be produced. I could understand some small difference but one system reports very healthy test coverage and the other, absolutely none. Yikes.
I've read a good deal of the Salesforce documentation on this but it appears quite light on what is actually happening behind the scenes. I did find an article surrounding ensuring that your trigger test exercies bulk data scenarios - so I added coverage for that - but it didn't move the numbers at all.
Any other ideas? Much appreciated, thanks for all your responses.
Rich