You need to sign in to do that
Don't have an account?

cvering test coverage
Hi all,
i have written tes class for this.But it covers 71%.How to rectify to cover 75% above.Any one can u please help me.
public class optwizardcls {public string tabname{set;get;}public string url{get;set;}public string url1{get;set;}public string url2{get;set;}public string url3{get;set;}public string url4{set;get;}public string url5{get;set;}public string ust;public String a1id{get;set;}public String aid{get;set;}public Id cid{get;set;}public Id pid{get;set;}public Id oid{get;set;}public id qid{set;get;}pagereference pref;public set<id> conset=new set<id>();String TabInFocus = System.currentPageReference().getParameters().get('aid');public optwizardcls(){a1id=apexpages.currentPage().getParameters().get('aid');aid=apexpages.currentPage().getParameters().get('accid');cid=apexpages.currentPage().getParameters().get('cntid');pid=apexpages.currentPage().getParameters().get('ploc');oid=apexpages.currentPage().getParameters().get('oppId');qid=apexpages.currentPage().getParameters().get('quoteid');url='apex/accountwizard';if(aid!=null)url1='/apex/WizardContact?accid='+aid;if(aid!=null)url2='/apex/physicallocation?accid='+aid;if(aid!=null)url3='/apex/opportunitywizard?accid='+aid;
}
public void getaccrefreshtab(){if(aid!=null)url='apex/accountwizard?accid='+aid;else if(a1id!=null)url='apex/accountwizard?aid='+a1id;}public void getcontRefreshTab(){try{url1='/apex/WizardContact?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account'); ApexPages.addMessage(myMsg);}}public void getphyrefreshtab(){try{url2='/apex/physicallocation?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account'); ApexPages.addMessage(myMsg);}}
public void getopprefreshtab(){try{url3='/apex/opportunitywizard?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account'); ApexPages.addMessage(myMsg);}}public void getquoteRefreshTab(){try{url4='/apex/QuoteWizard?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account'); ApexPages.addMessage(myMsg);}}
static testmethod void optwizardtest(){
//Account acc=new Account(name='test',Account_Customer_ID__c='123test');//insert acc;test.starttest();optwizardcls opt=new optwizardcls();
opt.getaccrefreshtab();opt.getcontRefreshTab();opt.getphyrefreshtab();opt.getopprefreshtab();opt.getquoteRefreshTab();test.stopTest();
}
}
thanks in advance
Hi,
Use the below code:-
I presume it should cover 80% of your class.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.