• Puja Patil 18
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
How to write @Test Class for Following Controller :

public with sharing class ReportController { 
                   
    Public Id lookupid{get;set;}
    public Question_Bank_Page__c obj1{get;set;}
    public Question_Option__c lookup;
    public List<Question_Option__c> OptionList{get;set;}
    public List<Question_Option__c> OptionList2{get;set;}
    public Question_Option__c Option{get;set;}
    private ApexPages.StandardController controller;
   
    public PageReference lookupid() {
        
        System.debug('****************Lookup id new*1************************'+obj1.Feedback__c);
        return null;
    }
    public ReportController(ApexPages.StandardController controller) {
        obj1= (Question_Bank_Page__c)controller.getRecord();
         System.debug('****************Lookup id new*2************************'+obj1.Feedback__c); 
    }
    public PageReference PassingParameter(){
        lookupid=obj1.Feedback__c;
        system.debug('++++++++++++++++LOOKUP ID++++++++++++++++++++'+lookupid);
        
        OptionList=[Select Customer_Name__c, CreatedDate, Customer_Email__c, Customer_Phone__c, Response__c, Question__r.Related_Feedback__r.Feedback_Name__c, 
        Question__r.Related_Feedback__r.Count_Question__c, Question__r.Related_Feedback__r.Feedback_Taken_by_Contact__c, Question__r.Question__c, 
        Question__r.Related_Feedback__r.CreatedDate From Question_Option__c where Question__r.Related_Feedback__c=:lookupid Limit 1];
        system.debug('++++++++++++++++++++OPTION LIST++++++++++++++++++++'+OptionList);
        
        OptionList2=[Select Customer_Name__c, CreatedDate, Response__c, Question__r.Question__c From Question_Option__c where Question__r.Related_Feedback__c=:lookupid];
        system.debug('++++++++++++++++++++OPTION LIST++++++++++++++++++++'+OptionList2);
        return null;
    }
How to write @Test Class for Following Controller :

public with sharing class ReportController { 
                   
    Public Id lookupid{get;set;}
    public Question_Bank_Page__c obj1{get;set;}
    public Question_Option__c lookup;
    public List<Question_Option__c> OptionList{get;set;}
    public List<Question_Option__c> OptionList2{get;set;}
    public Question_Option__c Option{get;set;}
    private ApexPages.StandardController controller;
   
    public PageReference lookupid() {
        
        System.debug('****************Lookup id new*1************************'+obj1.Feedback__c);
        return null;
    }
    public ReportController(ApexPages.StandardController controller) {
        obj1= (Question_Bank_Page__c)controller.getRecord();
         System.debug('****************Lookup id new*2************************'+obj1.Feedback__c); 
    }
    public PageReference PassingParameter(){
        lookupid=obj1.Feedback__c;
        system.debug('++++++++++++++++LOOKUP ID++++++++++++++++++++'+lookupid);
        
        OptionList=[Select Customer_Name__c, CreatedDate, Customer_Email__c, Customer_Phone__c, Response__c, Question__r.Related_Feedback__r.Feedback_Name__c, 
        Question__r.Related_Feedback__r.Count_Question__c, Question__r.Related_Feedback__r.Feedback_Taken_by_Contact__c, Question__r.Question__c, 
        Question__r.Related_Feedback__r.CreatedDate From Question_Option__c where Question__r.Related_Feedback__c=:lookupid Limit 1];
        system.debug('++++++++++++++++++++OPTION LIST++++++++++++++++++++'+OptionList);
        
        OptionList2=[Select Customer_Name__c, CreatedDate, Response__c, Question__r.Question__c From Question_Option__c where Question__r.Related_Feedback__c=:lookupid];
        system.debug('++++++++++++++++++++OPTION LIST++++++++++++++++++++'+OptionList2);
        return null;
    }