+ Start a Discussion

Getting Visualforce Error in ftest



I am writing a f-test for an existing functional page in which  I am trying to get the page details but everytime I run my f-test its giving "VisualForce- Error". Plz find the code below


Any help on this is highly appreciated 


The contract insertion code is not adding here which is a part of ftest. 


static testMethod void testPageDetails(){


    PageReference ref = Page.TestPage;

     ref.getParameters().put('Id', contractId);


     String body = (ref.getContent()).toString();

     System.debug('***Details ::'+body)







<apex:page controller="TestController" cache="false" title="FTest">
  <!-- Begin Default Content REMOVE THIS -->
  This is your new Page :: {!contId}
  <!-- End Default Content REMOVE THIS -->
Billing Name : {!billingName}





public class TestController {

String contId = null;
private Contract contract;


public TestController(){
contId = System.currentPageReference().getParameters().get('Id');

 this.contract = [Select BillingFirstName,BillingLastName
                  FROM Contract
                  Where Id = :contId];


public String getContId(){
 return contId;

public String getBillingName() {
 return contract.BillingFirstName+' '+contract.BillingLastName;



P.S. The above Ftest works fine if I use the existing contract number from the App.