You need to sign in to do that
Don't have an account?
Test class for trigger Before update
The Trigger class is: trigger FAAsettingCurrentLimit on Request__c(before update) { There are two objects ,object 1-Request__c and object 2-Limit__c
The test class for this trigger class is
@isTest
But its Showing error in (:CategoryLimit.id) and if i remove that line the trigger name itself not displayed after running the test class.
|
Hi,
In below query there from clause is missing add the from clause in query
Limit__c[] clist=[select id,Category__c ,Desired_US_Dollar_Limit__c,Current_US_Dollar_Limit__c,
Request__c where id=:CategoryLimit.id];
Try the below code snippet as reference:
Limit__c[] clist=[select id,Category__c ,Desired_US_Dollar_Limit__c,Current_US_Dollar_Limit__c,
Request__c from Limit__c where id=:CategoryLimit.id];
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi
@isTest
private class FAACurrentLimitTest {
static testMethod void myUnitTest() {
Request__c req = new Request__c();
req.Request_Status__c='Approved';
.
.//here insesrt the mandatory fields
.
insert req;
.Limit__c CategoryLimit=new Limit__c (Category__c = 'Treasury',
Desired_US_Dollar_Limit__c=100.00,Current_US_Dollar_Limit__c=120.00,Request__c=req.Id);
insert CategoryLimit;
req.Request_Status__c='Open';
update req;
}
}
Regards,
Rajesh S.