i am new to Salesforce and i am trying to write a test class for code coverage to a trigger. Trigger's functionality is working fine, but everytime i try to run Test class the test coverage is showing as 0%. even i am not sure what i am writing is correct or not. can someone please help me on this.
Trigger
trigger ExecutorTrigger on Changes(after update){
Changes ChangesObj = Trigger.New[0];
List<Executor__c> ExecutorObj = new List<Executor__c>();
List<Executor__c> ExecutorData = [select Id from Executor__c where ChangesExec_Id__c=:ChangesObj.id order by Name desc];
if(ExecutorData.size()==0) {
Executor__c Executor = new Executor__c(ChangesExec_Id__c=ChangesObj.Id,ct.Start__c = System.now().date());
ExecutorObj.add(Executor);
insert ExecutorObj;
} else {
Executor__c Executor = new Executor__c(ChangesExec_Id__c=ChangesObj.Id);
ExecutorObj.add(Executor);
insert ExecutorObj;
}
}
}
}
Test Class
@isTest
private class ExecutorTest {
static testMethod void ExecutorTest() {
Changes cNew = [Select Id from Changes limit 1];
Executor ct = new Executor();
ct.ChangesExec_Id__c= cNew.Id;
ct.Start_Date__c = System.now().date();
ct.End_Date__c = System.now().date();
insert ct;
Executor ctNew = [select Id from Executor where Id = :ct.Id];
update ctNew;
}
}
Thanks, ravi.