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
devloper sfdcdevloper sfdc 

how to write test class for this apex class

Hello All ,

I need test class for this code please help me i am not able to create test class for this code.
public class BBH_Survey {
    public  String   Survey_res {get;set;}
    public  String UpdateSurvey_res {get;set;}
    public Survey_Question__c ques_id{get;set;}
    Public String CasId;
    Public String Survey_comments {get;set;} 
    public boolean flag{get;set;}
    public list<BBH_Surveys__c> lstbbhsury;
    Public New_Surveys__c surveyName {get;set;}
     public String modifySurvey{get;set;}
    public string surveyId;
    public String imageURL{get;set;}
    public String modiFiResponce {get;set;}
    public BBH_Survey(apexPages.StandardController std) 
        surveyId = Apexpages.currentPage().getParameters().get('id');
       // contactId = Apexpages.currentPage().getParameters().get('cId'); 
      lstbbhsury=[select id from BBH_Surveys__c where CaseId__c =:CasId]; 
       List<New_Surveys__c> schoolsurvey =[select School_URL__c,School_Logo__c from New_Surveys__c where id=:surveyId];  
    Public  PageReference survey_1(){
           PageReference Checksuvey = page.SurveyAlreadyFillAndUpdate;   
            return Checksuvey; 
    List<case> lstCase=[select id,status ,Survey_fill__c from case where id =:CasId];
    List<New_Surveys__c> schoolsurvey =[select School_URL__c,School_Logo__c from New_Surveys__c where id=:surveyId];               
        // PageReference myVFPage = page.Survey_saved;
        string url=schoolsurvey[0].School_URL__c;
        PageReference myVFPage = new PageReference(url);
              BBH_Surveys__c bbh=new BBH_Surveys__c();
               bbh.Survey_Response__c= '1';
        bbh.Survey_Comments__c =Survey_comments;
              insert bbh;
              return myVFPage;
        } catch(Exception e) {
             PageReference myVFPage1 =page.Survey_Permission_Required;  
            return myVFPage1;

Tad Aalgaard 3Tad Aalgaard 3
Could you please post what you have written so far for your test class?
Tad Aalgaard 3Tad Aalgaard 3
Nearly half of your posts are asking others to write your test classes for you.  It doesn't seem fair to ask others to write your code for you while you get paid for it and we do not.  Just my two cents. (

Please try and create test classes on your own and then post what you have written so far when you have an issue.