You need to sign in to do that
Don't have an account?
Getting Visualforce Error in ftest
Hi,
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)
}
Page
<apex:page controller="TestController" cache="false" title="FTest">
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page :: {!contId}
<!-- End Default Content REMOVE THIS -->
Billing Name : {!billingName}
</apex:page>
Controller
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.