You need to sign in to do that
Don't have an account?
Help with Test Trigger
Hi Everyone,
I'm having a problem with Test Trigger it says 0%, I've done reasearch but still no luck or no idea how to do it.
my code as follows;
trigger disabilityChecked on Care_Recipient_Information__c (before insert, before update)
{
Boolean disability, chronic;
for (Care_Recipient_Information__c obj : Trigger.new)
{
if ((obj.DMD__c == true) ||
(obj.DS__c == true) ||
(obj.Learning_Disability__c == true) ||
(obj.Spina_Bifida__c == true) ||
(obj.Hearing_Disability__c == true) ||
(obj.Visual_Disability__c == true) ||
(obj.Dyslexia__c == true) ||
(obj.Physical_Disability__c == true) ||
(obj.Rare_Syndromes__c == true) ||
(obj.ID__c == true))
{
obj.DisabilityNumber__c = 1;
disability = true;
obj.Disability__c = disability;
}
else
{
disability = false;
chronic = false;
obj.Disability__c = disability;
//obj.chronic_Illness__c = chronic;
}
}//FOR
}//END
Thank you for the assistance,
Hi try this
@istest
public class test_Care_Recipien
{
public static testmethod void test_care()
{
Care_Recipient_Information__c cr=new Care_Recipient_Information__c();
cr.DMD__c = true;
cr.DS__c = true;
cr.Learning_Disability__c = true;
cr.Spina_Bifida__c = true;
cr.Hearing_Disability__c = true;
cr.Visual_Disability__c =true;
cr.Dyslexia__c = true;
cr.Physical_Disability__c = true;
cr.Rare_Syndromes__c =true;
cr.Disability__c=true;
insert cr;
cr.DMD__c =false;
cr.DS__c = false;
cr.Disability__c=false;
update cr;
}
}
regards
venkatesh
didn't work.
it still says 0%
But check when you run the test class you can see the coverage through each Trigger.
Also it might help if you click Setup --> Apex Classes --> Compile all Classes
Let me know this solves your issue
Lipton,
Try below :-
Thanks.
getting this error now,
http://s13.postimg.org/hz3ybvnuv/error.jpg
got it covered 100% http://s23.postimg.org/y7m5divm3/Covered.jpg
but it won't let me post onto the server http://s15.postimg.org/p7brlg38r/block.jpg
err.. kinda frustrating, help! :(.