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

need help on test class for bellow code.trigger
trigger Example on Product2 (before insert,before update,after insert,after update) {
System.debug('Inside Trigger ** -->');
Product2TriggerHelper helper = new Product2TriggerHelper();
if(!System.label.SYS_RunAPTS_ProductTrigger.equalsIgnoreCase('NO')){
if (Trigger.isInsert && Trigger.isAfter) {
try{
helper.onAfterInsert(Trigger.New);
}catch(Exception ex){
system.debug('Exception exists while inserting PriceListItem' + ex.getMessage());
}
}
if (Trigger.isUpdate && Trigger.isAfter) {
try{
helper.onAfterUpdate(Trigger.New);
}catch(Exception ex){
system.debug('Exception exists while inserting PriceListItem' + ex.getMessage());
}
}
}
}
Thanks in advance.
System.debug('Inside Trigger ** -->');
Product2TriggerHelper helper = new Product2TriggerHelper();
if(!System.label.SYS_RunAPTS_ProductTrigger.equalsIgnoreCase('NO')){
if (Trigger.isInsert && Trigger.isAfter) {
try{
helper.onAfterInsert(Trigger.New);
}catch(Exception ex){
system.debug('Exception exists while inserting PriceListItem' + ex.getMessage());
}
}
if (Trigger.isUpdate && Trigger.isAfter) {
try{
helper.onAfterUpdate(Trigger.New);
}catch(Exception ex){
system.debug('Exception exists while inserting PriceListItem' + ex.getMessage());
}
}
}
}
Thanks in advance.
1) http://amitsalesforce.blogspot.com/2015/06/best-practice-for-test-classes-sample.html
Let us know if this will help you
All Answers
private class Example _Test
{ static testMethod void TestAccount()
{
Example exp= new Example ();
exp.Name ='Test';
insert exp;
exp.Name = 'Test Acc';
update exp;
}
}
1) http://amitsalesforce.blogspot.com/2015/06/best-practice-for-test-classes-sample.html
Let us know if this will help you
Thank you for reply, but code covarage is 20%.
could you please help on 75%. covarage.
Thank you.
label.SYS_RunAPTS_ProductTrigger that should be YES.
Update label and try same test class again and please check which lines are not covered in Developer console
thank you very much . its working fine 85% code caovarage.