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
Aurora Ganguly 10Aurora Ganguly 10 

solution for test class

hello all,
Can anyone help me in fixing this test class. I tried and written some portion , but its not showing any thing , although it is not solved , so am sharing my controller, for which i want the test class. 
plz share if any one could solve. 

Regard Aurora,


Below is the controller .
public with sharing class ctrl_outsidemenu {

   Public String Dishname { get; set;}
   Public Double Price { get; set;}
   Public Integer qty { get; set;}
   Public String remarks { get; set;}
   Public id  oid { get; set;}
    
    public ctrl_outsidemenu(ApexPages.StandardController controller) {
    			Menu__c m = new Menu__c();
    }
    
    String s = 'Food';
    public String getString() {
        return s;
    }
            
    public void setString(String s) {
        this.s = s;
    }
    
    public PageReference csave(){
    
       try{
       oid = ApexPages.currentPage().getParameters().get('id');
       Menu__c m = new Menu__c();
       m.Dish_Name__c =Dishname;
       m.Price__c =Price;
       m.Category__c = s;
       m.SubCategory__c ='Extra';
       m.Status__c ='Not available';
       insert m;
       
       
       OLI__c oli = new OLI__c();
       oli.Menu__c = m.id;
       oli.Order__c = oid;
       oli.Qty__c = qty;
       oli.Remarks__c = remarks;
       insert oli;
       }
       catch(Exception e){
         ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,e.getmessage());
         ApexPages.addMessage(myMsg);
       }
      PageReference retURL = new PageReference('/'+oid);
      retURL.setRedirect(true);
      return retURL;
    }
    public PageReference ccancel(){
    
      oid = ApexPages.currentPage().getParameters().get('id');
      PageReference retURL = new PageReference('/'+oid);
      retURL.setRedirect(true);
      return retURL;
    }
}

 
DeveloperDeveloper
Hi Ganguly,


May I request you to please check for Test Class Generator App from APP Exchange. Please refer the below link.

https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000EFozgUAD

I hope it will be helpful.

Please mark it as best answer if the information is informative.

Thanks & Regards 
Gopal M.