
Please check below post for test class. I hope that will help youhttp://amitsalesforce.blogspot.in/search/label/Test%20ClassPlease check below post. How to write test classeshttp://amitsalesforce.blogspot.in/2015/06/best-practice-for-test-classes-sample.htmlPlease check below Example how to create test class for trigger, Controller and Standard Controller.Test Class for Trigger @isTest
public class TriggerTestClass
{
static testMethod void testMethod1()
{
// Perform DML here only
}
}
Test Class for Standard Controller
@isTest
public class ExtensionTestClass
{
static testMethod void testMethod1()
{
Account testAccount = new Account();
testAccount.Name='Test Account' ;
insert testAccount;
Test.StartTest();
ApexPages.StandardController sc = new ApexPages.StandardController(testAccount);
myControllerExtension testAccPlan = new myControllerExtension(sc);
PageReference pageRef = Page.AccountPlan; // Add your VF page Name here
pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
Test.setCurrentPage(pageRef);
//testAccPlan.save(); call all your function here
Test.StopTest();
}
}
Test Class for Controller class
Please let us know if this will help youThanksAmit Chaudhary@isTest
public class ControllerTestClass
{
static testMethod void testMethod1()
{
Account testAccount = new Account();
testAccount.Name='Test Account' ;
insert testAccount;
Test.StartTest();
PageReference pageRef = Page.AccountPlan; // Add your VF page Name here
pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
Test.setCurrentPage(pageRef);
myController testAccPlan = new myController();
//testAccPlan.save(); call all your function here
Test.StopTest();
}
}