function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raj88Raj88 

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.
Best Answer chosen by Raj88
ShaTShaT
Hi,

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();
}
}