You need to sign in to do that
Don't have an account?
ms Scott
ChatterAnswersEscalationTriggerTest" failue
I've created my first Apex Scheduler Class. Tested and working like champ in sandbox. Getting failues trying to puch into production.
Class= "ChatterAnswersEscalationTriggerTest" failue;
Method Name = "validateQuestionEscalation"
Error Message = "System.QueryException: List has no rows for assignment to SObject"
"Stack Trace: Class.ChatterAnswersEscalationTriggerTest.validateQuestionEscalation: line 17, column 1"
Thanks in Advance!
Michael
Class= "ChatterAnswersEscalationTriggerTest" failue;
Method Name = "validateQuestionEscalation"
Error Message = "System.QueryException: List has no rows for assignment to SObject"
"Stack Trace: Class.ChatterAnswersEscalationTriggerTest.validateQuestionEscalation: line 17, column 1"
Thanks in Advance!
Michael
May I suggest you please check with below links from the stack exchange community with a similar issue which might help you to accelerate further.
- https://salesforce.stackexchange.com/questions/86308/apex-test-failure-chatteranswersescalationtriggertest
- https://developer.salesforce.com/forums/?id=906F000000093W0IAI
Hope this helps.Regards,
Nagendra.
(the purpose is to update a date field every night after midnight)
global class SchedulerToUpdateDate implements Schedulable { List<Grad_Employment_Detail__c> allRec = new List<Grad_Employment_Detail__c>(); List<Grad_Employment_Detail__c> toUpdate = new List<Grad_Employment_Detail__c>(); global void execute(SchedulableContext sc){ allRec = [select id, current_Date__c from Grad_Employment_Detail__c]; for(Grad_Employment_Detail__c ge: allRec){ ge.current_Date__c = date.today(); toUpdate.add(ge); } update toUpdate; } }
Was getting chatter answers error trying to push into production. Discovered I had no Test class. Here's the test class;
@IsTest public class SchedulerToUpdateDate_Test{ public static testmethod void unitTest(){ Test.starttest(); Grad_Employment_Detail__c to = new Grad_Employment_Detail__c (); to.current_Date__c = date.today(); insert to; SchedulerToUpdateDate wau = new SchedulerToUpdateDate(); String sch = '0 00 1 3 * ?'; system.schedule('Test', sch, wau); test.stoptest(); } }
Now I'm getting this error trying to push into production;
Code Coverage Failure
Your code coverage is 0%. You need at least 75% coverage to complete this deployment.
SchedulerToUpdateDate
Error Message;
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Grad_Employment_Details__c]: [Grad_Employment_Details__c]
Stack Trace: Class.SchedulerToUpdateDate_Test.unitTest: line 7, column 1
Original Post; for more details
https://success.salesforce.com/answers?id=9063A0000019alZ
Really need some help with this.
Thanks in Advance!
Michael Scott