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

Test for trigger?
Hai ,i am new to test casees so can any one help me how to write test case for following code
trigger PrefixDoctor on Lead (before insert,before update)
{
List<Lead> leadList = trigger.new;
for(Lead l: leadList)
{
l.firstname = 'Dr.'+ l.firstname;
}
}
trigger PrefixDoctor on Lead (before insert,before update)
{
List<Lead> leadList = trigger.new;
for(Lead l: leadList)
{
l.firstname = 'Dr.'+ l.firstname;
}
}
As per your requirment of test class,i have gone through it and tried about.
@IsTest
Public class Test_PrefixDoctor
{
Public static testmethod void PrefixDoctor()
{
Lead l = new Lead();
l.FirstName='Test';
l.LastName='Test2';
l.Company='Cmy';
Insert l;
System.AssertEquals(l.Id!=null,True);
}
}
If it gives you solutions please mark as solutions for KUDOS or else get back to me with your requirment clearly.
Hello
Name of trigger(PrefixDoctor) would be test class name(Test_PrefixDoctor) through which we can identify.
Thanks
Srinivas