+ Start a Discussion
sales force 48sales force 48 

test class issue when i pass account id in visualforce

Hi Guys,

I have custom button on account called "registration"
and when i click that button  it call extension controller which has written on account object  developed visualforce page appears for the lead registration 
the url looks like (https://c.cs17.visual.force.com/apex/ManualRegistration?id=001g000000ZNN4G)

and my custom button javascript code is as below

if("{!Account.companyname__c}" == "xxx")
{  
window.open('/apex/ManualRegistration?id={!Account.Id}',"_blank","width=1000,height=650,scrollbars=1");  
}  


but the issue here is that when i write a test class to that particulat visualforce controller
it shows an error is that list has no rows on Sobject


my test class is below

@isTest
public class ManualRegistrationTest
{
    public static testMethod void InsertLeadMethodforindividual()
    {            
    
        Account acc=new account();
        acc.name='Acctest';
        insert acc;
        
        Test.setCurrentPageReference(new PageReference('Page.ManualRegistration'));
        System.currentPageReference().getParameters().put('id', acc.Id);
        
        
        ApexPages.StandardController stdController = new ApexPages.StandardController(acc);
        ManualRegistration objGenerateJobOfferController = new ManualRegistration(stdController);
        }
can any one please let me know the  solution for it as i am getting 0% code coverage even am trying to write a lot of code
ManojjenaManojjena
Hi,
If possibel post your class code .