You need to sign in to do that
Don't have an account?
Alan DePew
Test Class not working for After Update Trigger
Hello,
I am having trouble getting my test class to work with my after update trigger. When I run my test it is showing 0% code coverage. Can anyone help me to understand why it is not working?
Here is the trigger code:
Here is my test class:
I am having trouble getting my test class to work with my after update trigger. When I run my test it is showing 0% code coverage. Can anyone help me to understand why it is not working?
Here is the trigger code:
trigger FUS_UGGR_Application_Submitted on TargetX_SRMb__Application__c (After Update) { For (TargetX_SRMb__Application__c A : Trigger.New) { //Update Submitted Application Contact record to "Applicant" String ContactId = Trigger.newMap.get(A.ID).TargetX_SRMb__Contact__c; String New_Stage = Trigger.newMap.get(A.ID).TargetX_SRMb__Stage__c; String Old_Stage = Trigger.oldMap.get(A.ID).TargetX_SRMb__Stage__c; String App_Type = Trigger.newMap.get(A.ID).TargetX_SRMb__Application_Type__c; Contact C = [select id from Contact where id = :contactid]; IF(New_Stage <> Old_Stage && New_Stage == 'Submitted' && App_Type <> 'Undergraduate Non-Degree Post Secondary'){ C.UGGR_Student_Stage__c = 'Applicant'; Update C; } } }
Here is my test class:
@isTest public class FUS_Test_UGGR_App_Submit { //Perform Tests static testMethod void ValidateUGGRAppSubmit() { Contact c = new Contact( FirstName = 'Test', LastName = 'Test' ); Insert c; TargetX_SRMb__Application__c a = new TargetX_SRMb__Application__c( TargetX_SRMb__Contact__c = c.Id, TargetX_SRMb__Application_Type__c = 'Undergraduate', TargetX_SRMb__Stage__c = 'In Progress' ); Insert a; Test.StartTest(); a.TargetX_SRMb__Stage__c = 'Submitted'; Update a; Test.stopTest(); } }
Contact C = [select id,UGGR_Student_Stage__c from Contact where id = :contactid];