You need to sign in to do that
Don't have an account?
Samadhan Sakhale 3
Writing Test Class
Hi All,
I am new to SFDC and i have written one trigger but i'm not able to write test class for it someone please tell me how can i write test class for this trigger my Trigger is
trigger FetchVatvalue on Quote__c (before insert,before update)
{
//create reference table for lookup value
Map<String, Decimal> vatMap = new Map<String, Decimal>();
//build reference table for VAT rates
for (VAT__c vat : [SELECT Name,Vat_Rate__c FROM VAT__c])
vatMap.put(vat.Name, vat.Vat_Rate__c);
//update Quote__c with VAT rate
for (Quote__c q : trigger.new)
{
Decimal vatRate = vatMap.get(q.Country_Code__c);
q.VAT_Rate__c = vatRate;
}
}
this trigger is wrtten for automaticaly fetch value from another object using picklist
thank you,
Sam
I am new to SFDC and i have written one trigger but i'm not able to write test class for it someone please tell me how can i write test class for this trigger my Trigger is
trigger FetchVatvalue on Quote__c (before insert,before update)
{
//create reference table for lookup value
Map<String, Decimal> vatMap = new Map<String, Decimal>();
//build reference table for VAT rates
for (VAT__c vat : [SELECT Name,Vat_Rate__c FROM VAT__c])
vatMap.put(vat.Name, vat.Vat_Rate__c);
//update Quote__c with VAT rate
for (Quote__c q : trigger.new)
{
Decimal vatRate = vatMap.get(q.Country_Code__c);
q.VAT_Rate__c = vatRate;
}
}
this trigger is wrtten for automaticaly fetch value from another object using picklist
thank you,
Sam
Hope it'll help you.
All Answers
Hope it'll help you.
is there compulsory to write assertEqual() function in test class
Sam
also please select post which have answer as a best solution which is below the post marked a best solution currently.
Sam