+ Start a Discussion
rebvijkumrebvijkum 

Test class for simple controller

Never wrote a test class before, need some help.Here i'm getting data from custom settings

My_Class:
public class EligibilityTabController{
    public CatTabDefault__c EligibilityTab {get; set;}
    public list<CatTabDefault__c> catset {get; set;}   
    public String links;     
    public EligibilityTabController() { 
        catset = CatTabDefault__c.getAll().values();
        EligibilityTab = CatTabDefault__c.getInstance('Eligibility');           
        links= [SELECT Links__c FROM Category_Tab_Link__kav WHERE PublishStatus = 'online' AND Language = 'en_US' AND UrlName =:                           EligibilityTab.Category_Links__c].Links__c;      
         }                
    public String getEligicatlinks() {
        return links;      
    }    
}

Test class:
@isTest
public class EligibilityTabController_TestClass{
    public static testMethod void myUnitTesting(){
        //test coding
    }    
}
rebvijkumrebvijkum

My Test Class covers only 77%. Any Help please???
@isTest(SeeAllData=true)
public class EligibilityTabController_TestClass{
        static testMethod void ValidateEligibilityTabController(){
        EligibilityTabController x=new EligibilityTabController();  
        system.assertnotequals(x.catset,null);
        system.assertnotequals(x.links,null);
        system.assertnotequals(x.EligibilityTab,null);
        system.assertequals(x.EligibilityTab.Category_Links__c,'Category-Links-Eligibility');        
    }    
}