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
sabeerasabeera 

Please help me to write test classs for the following controller.

Hi,


I tried  but its not working

//Controller class for LoginPagePartners(custom login page) for Partner users
global class CustomLogin{
   //Declare Email and password fileds
    global String Email{get; set;}
    global String pwd {get; set;}c
    
    //getting Email and Password values  
     global void getEmail(){
     Email=System.currentPageReference().getParameters().get('Email');
     }
        
     global void getpwd(){
     pwd=System.currentPageReference().getParameters().get('pwd');
     }
     //Actual Login button functionality
     global PageReference login(){ 
     //setting redirect URL     
     String startUrl = '/partners';
     //Using Site.login(string,string,string) standard functionality 
     PageReference ref = Site.login(Email, pwd, startUrl);
     return ref;
             
    }
}
Best Answer chosen by sabeera
Harish RamachandruniHarish Ramachandruni

Hi ,


I am writen in org it's getting 100% check it any issue let me know  . 




User-added image


 
@isTest 
Public  class harishraoTeat{
 
 
   Public  static testMethod void harish1() {
   
   
   string emailid = 'harish.rao.salesforce@gmail.com';
   
  string  posswd = '9676930011';
 
 
apexpages.currentpage().getparameters().put('Email' , emailid );

apexpages.currentpage().getparameters().put('pwd' , posswd );


apexpages.currentpage().getparameters().put('Email' , emailid );



 
 CustomLogin login = new CustomLogin();
 
 
 login.getEmail();
 
  login.getpwd();

   login.login();

 
 
 
   
      
    }
}



If it is usefull make it best answer .