You need to sign in to do that
Don't have an account?
Chinnodu
Hi, how to write a test class on trigger ?
Hi All,
How to write a test class on trigger ? below my code on my trigger .pls help me on this.
trigger SyncToOpp on Quote (after update) {
Set<Id> qIds = new Set<Id>();
for (Quote q : Trigger.new)
{
if (q.Status == 'Accepted')
{
qIds.add(q.Id);
}
}
if (qIds.size() > 0 && !System.isFuture())
{
SyncQuoteWithOpportunity.SyncQuote(qIds);
}
REgards,
Viswanadham
How to write a test class on trigger ? below my code on my trigger .pls help me on this.
trigger SyncToOpp on Quote (after update) {
Set<Id> qIds = new Set<Id>();
for (Quote q : Trigger.new)
{
if (q.Status == 'Accepted')
{
qIds.add(q.Id);
}
}
if (qIds.size() > 0 && !System.isFuture())
{
SyncQuoteWithOpportunity.SyncQuote(qIds);
}
REgards,
Viswanadham
1. Create Quote records first in test class
2. Update quote to meet the criteria for Status as accepted.
3. When this criteria is met, your code will be covered , but not sure about adding assert as SyncQuoteWithOpportunity.SyncQuote(qIds); functionality is not known to me.
Try the below code,
Please let me know if you need any help regarding this.
Thanks,
Vijay