+ Start a Discussion
Abhishek Kumar 149Abhishek Kumar 149 

how to write test class for below code?

 isOutput = false;
        isInput =  false;
        
        parentId = ApexPages.currentPage().getParameters().get('pId');
        recordId = ApexPages.currentPage().getParameters().get('Id');
      
      
        }
        
       
        
ManojjenaManojjena
HI Abhishek,

You need to create a record in test method .
Like below ,
Account acc=new Account();
acc.Name='TestAccount'
insert acc;
 ApexPages.currentPage().getParameters().put('pId',acc.Id);
replace acc.Id with your desired record id .
Do the same for next line .
let me know if it helps !!
Thanks
Manoj