You need to sign in to do that
Don't have an account?
travis.truett
Trigger Won't Deploy (Code Coverage)
I wrote a trigger and a test class for it. The code coverage is 83% in the sandbox. When I try to roll it out, however, I get an error saying my code coverage is only 65% and that I can't deploy. I'm not sure why this is happening...
Don't understand why my coverage changes when I go from the sandbox to deployment. I'm someone could help me figure this out, I'd appreciate it. Thanks
Don't understand why my coverage changes when I go from the sandbox to deployment. I'm someone could help me figure this out, I'd appreciate it. Thanks
In your trigger it looks like you are assigning result of a SOQL query to an object like
CustomObject__c obj = [Select Id,Field1__c From CustomObject__c Where ....];
When the query does not return any results, it throws error like that. If you have some thing like that, change it to
List<CustomObject__c> objs = [Select Id,Field1__c From CustomObject__c Where ....];
All Answers
Once you fix this error then coverage will get increased automatically.
Best Regads,
-Vivek
Hi Travis,
Do you have same code replca of production in sandbox then do runall test in sandbox .
You should get same error and it's easy to fix .
Best Regards,
-Vivek
Class testEditSchedule
Method Name testUpdateSchedule
Pass/Fail Fail
Error Message System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []
Stack Trace Class.testEditSchedule.testUpdateSchedule: line 46, column 1
Class ZendeskUtilitiesTests
Method Name ticketCreated
Pass/Fail Fail
Error Message System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Create_followup: execution of AfterInsert
caused by: System.QueryException: List has no rows for assignment to SObject
Trigger.Create_followup: line 2, column 1: []
Stack Trace Class.ZendeskUtilitiesTests.createOpportunity: line 29, column 1
Class.ZendeskUtilitiesTests.ticketCreated: line 34, column 1
In your trigger it looks like you are assigning result of a SOQL query to an object like
CustomObject__c obj = [Select Id,Field1__c From CustomObject__c Where ....];
When the query does not return any results, it throws error like that. If you have some thing like that, change it to
List<CustomObject__c> objs = [Select Id,Field1__c From CustomObject__c Where ....];