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

Test class for @future
My Class:
public class Cls_FutureMethods{
@future
public static void processLargeAccounts(Id AllTierID,Decimal TUDMin){
TUDTiers__c AllTierMin = [select Id,MinimumRange__c from TUDTiers__c where Id =: AllTierID];
AllTierMin.MinimumRange__c=TUDMin+0.01;
TUDTierUtility.isFutureUpdate = true;
update AllTierMin;
}
}
Test
@isTest
private class Test_FutureMethods
{
static testMethod void testTrigger()
{
Cls_FutureMethods fut= new Cls_FutureMethods();
TUDTiers__c tud = new TUDTiers__c();
tud.MinimumRange__c=45.67;
tud.Tier__c=25.36;
insert tud;
Decimal TUDMin=45.56;
TUDTierUtility.isFutureUpdate = true;
Test.StartTest();
Test.StopTest();
}
}
My Code coverage is 0. How can i increase the code coverage for this..Need help.
public class Cls_FutureMethods{
@future
public static void processLargeAccounts(Id AllTierID,Decimal TUDMin){
TUDTiers__c AllTierMin = [select Id,MinimumRange__c from TUDTiers__c where Id =: AllTierID];
AllTierMin.MinimumRange__c=TUDMin+0.01;
TUDTierUtility.isFutureUpdate = true;
update AllTierMin;
}
}
Test
@isTest
private class Test_FutureMethods
{
static testMethod void testTrigger()
{
Cls_FutureMethods fut= new Cls_FutureMethods();
TUDTiers__c tud = new TUDTiers__c();
tud.MinimumRange__c=45.67;
tud.Tier__c=25.36;
insert tud;
Decimal TUDMin=45.56;
TUDTierUtility.isFutureUpdate = true;
Test.StartTest();
Test.StopTest();
}
}
My Code coverage is 0. How can i increase the code coverage for this..Need help.
You need to pass the values to Future Method.
private class Test_FutureMethods
{
static testMethod void testTrigger()
{
Test.StartTest();
TUDTiers__c tud = new TUDTiers__c();
tud.MinimumRange__c=45.67;
tud.Tier__c=25.36;
insert tud;
Cls_FutureMethods.processLargeAccounts(tud,id,tud.MinimumRange__c);
Test.StopTest();
}
}