December 10, 2013

Test Class for Standard Controller in Salesforce

Check the below code for writing test class for standard controller apex class.

Sample Code:

  1. Account a = new Account( Name = 'Test' );  
  2. Class_Name obj = new Class_Name( new ApexPages.StandardController( a ) );  

here the controller is referred to a page where the standard controller is Account.

No comments:

Post a Comment