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
saurabh sharmasaurabh sharma 

no code coverage

My apex class is 
public class AlternateNamecl {
public Id URLId = System.currentPagereference().getParameters().get('id');
sobjecttype gettingWhatIDType ;
public string sUrl {get;set;}
    public AlternateNamecl(ApexPages.StandardController controller) {
    if(URLId != null){
      gettingWhatIDType = URLId.getSObjectType();
      String sEncodeID = EncodingUtil.base64Encode(blob.valueof(URLId+'-713ABP-XSH48-37VPK3J'));
      if(gettingWhatIDType == PreEmploy_Case__c.sObjectType){
        sUrl = Salesforcecl.GetSidesDotNetUrl() + 'AlternateName.aspx?ci='+sEncodeID ;
      }
      else{
      sUrl = Salesforcecl.GetSidesDotNetUrl() + 'AlternateName.aspx?oi='+sEncodeID ;
      }
    }
  }
}

And my test class is 
@isTest
public class AlternateNamecl_Test{
  static void testPageMethods() {
    Alternate_Names__c an = new Alternate_Names__c();
    insert an;
    PageReference pRef = Page.CaseAlternateName;
         pRef.getParameters().put('id', an.Id);
         Test.setCurrentPage(pRef);
         Test.startTest();
    ApexPages.StandardController controller = new ApexPages.StandardController(an);
    AlternateNamecl oAdd = new AlternateNamecl(controller);
    Test.stopTest();
  }
}

 
Arunkumar RArunkumar R
Hi Saurabh,

Add testMethod in your method. Change --> static void testPageMethods()  to --> static testMethod void testPageMethods() 

Hope this will helpful :)