There are situation when you want to set the record field value in writing test class for a controller using VF page.
Account testAccount = new Account(Name=’TestAcc’);
insert testAccount;
Contact con = new Contact();
con.firstName = ‘Test First’;
con.AccountId = testAccount.Id;
insert con;
PageReference pref = Page.ContactClone;
Test.setCurrentPage(pref);
ApexPages.StandardController con = new ApexPages.StandardController(con);
ContactClone ext = new ContactClone(con);
ext.contact.LastName = ‘TestLast’;