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
Akash jena 3Akash jena 3 

variable doesn't exist issue

i have written this test class but I am getting error like this
@istest
public class SplitTriggerTest {
    @testsetup
    Public static void split(){
        Account acc = new Account();
        acc.Name = 'Test Account1';
           insert acc;
        
        Equipment__c eqp = new Equipment__c();
        eqp.Name = 'E1';
        eqp.Category__c = 'B';
        insert eqp;
        
        Opportunity__c opp = new Opportunity__c();
        opp.Opportunity_Name__c = 'Test A';
        opp.Stage__c = 'Prospect';
        opp.CommercialFrom__c = 'Rent Alpha Private Limited';
        opp.Account__c = acc.id;
        insert opp;
        
        Opportunity_Product__c op = new Opportunity_Product__c();
        op.Equipment__c = eqp.id; 
        op.Opportunity__c = opp.id;
        op.Tenure_in_months__c = 1234;
        insert op;
        
        Split__c sp = new Split__c();
        sp.Amount__c = 1234;
        sp.Reason_for_Loss__c = 'Competition';
        sp.Competitor__c = 'Hewlett Packard';
        sp.Offer_Equipment__c = op.id;
        insert sp;       
    }
    @isTest
    Private static void splitamount(){
        Split__c spl = [Select id, Name from Split__c Limit 1];
        apexpages.StandardController sc = new apexpages.StandardController(sp);
        SplitTrigger c = new SplitTrigger(sc);
        
    }

}
User-added image
ShirishaShirisha (Salesforce Developers) 
Hi Akash,

Greetings!

Seems like the variable has defined in some other method due to which you are not able to pass the variable to the VF page.

Reference:https://developer.salesforce.com/forums/?id=906F0000000DECVIA4

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Akash jena 3Akash jena 3
how to fix that error