function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Teach_me_howTeach_me_how 

Yes or No - Do i need to create test class for page that has ONLY standard controller?

no extension controller, i only have standard controller.

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You do not need to write a test class for this page.  

 

You only need to test your apex code, and as you haven't written any, there is nothing for you to do.

 

 

All Answers

MagulanDuraipandianMagulanDuraipandian

Hi,

Test classes are written for Apex controllers not for VF pages.

 

http://infallibletechie.blogspot.in/2012/05/unit-testing.html

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution and click Kudos.

Teach_me_howTeach_me_how

yes do i have to test the controller of the page when im using standard controller?

MagulanDuraipandianMagulanDuraipandian

Yes... You have to write test class for extensions, even though that class has standard controller.

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution and click Kudos.

Teach_me_howTeach_me_how

Below is my simple VF with standard controller i did not create extension class for this VF... How can i create test class for this?

 

<apex:page standardController="Contact">  
  <apex:outputPanel id="thePanel" rendered="{!Contact.registered__c}">                  
      <apex:outputLink value="https:www.google.com" onclick="window.open(this.href,'','width=600,height=400,status=1,scrollbars=1,location=1'); return false">Omniture Specific User Report</apex:outputLink>
  </apex:outputPanel>  
</apex:page>
bob_buzzardbob_buzzard

You do not need to write a test class for this page.  

 

You only need to test your apex code, and as you haven't written any, there is nothing for you to do.

 

 

This was selected as the best answer
Teach_me_howTeach_me_how

Thanks bob your answer accept as solution

MagulanDuraipandianMagulanDuraipandian

Hi,

No need to write test class for standardController. You have to test classes for controllers and extensions not for standardController

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution and click Kudos.

ViwalViwal

It's simple,If you have not written any  Apex what dont have anything to test.