+ Start a Discussion
rupesh ranjanrupesh ranjan 

How to insert simple VF field  in test class

How to insert simple VF field  in test class some sample code plsss

Need to write test class for insertion not for standard object 

i have used simple controller like 
<apex:page controller="abc" > 
Main controller
Variable intialised like this

Public  class abc{

    public String to{get; set;}
    public String AddRecep{get; set;}

Naval Sharma4Naval Sharma4
Hi Rupesh,

To set a variable in test class you have to use following syntax.

//Create an instance of object
abc a = new abc();
a.to = 'test@test.com';

I hope this will work for you.

Mahesh DMahesh D
Hi Rupesh,

If possible paste the whole class, so that it will be easy to provide you better answer.