You need to sign in to do that
Don't have an account?

Test case assertion failed but test coverage is 100%
Hi.....
I have written a trigger on lead for awaiding duplication of leads . I have a problem with test case, my test class is
@isTest private class TestDuplead{ static testMethod void tm1(){ lead l=new lead(); l.lastname='sss'; l.company='yyy'; l.email='ve123@gmail.com'; insert l; lead l1=new lead(); l1.lastname='sss1'; l1.company='yyy1'; l1.email='ve123@gmail.com'; try { insert l1; }catch(System.DMLException e){ system.assert(e.getmessage().contains('lead with this email address already exists')); //line 18 }
I am getting
System.AssertException: Assertion Failed | Class..TestDuplead.tm1: line 18, column 1 |
If Assertion failed .....is there any problem?
Hi,
System.assert() functions helps you in validating the output with the expected one.
It is indicating that is not what its expecting. Once you run the test it will show you expected and actual value in report.
That should help you in identifying the mistake.
Regards,
Manjunath