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
Bard09Bard09 

Test code for components with custom controllers?

Does anyone have any tips or examples for how to write test code for components with custom controllers?  I've written a few myself, but am unable to find any documentation for how to instantiate a component for test purposes.

 

If anyone could point me to an example (or, better yet, post some test code you've written yourself!) that would be amazing.

 

I'm sure this could help others as well.  Google has been absolutely useless on the topic.

ngabraningabrani

There is an example in the later part of this article -

http://wiki.developerforce.com/index.php/An_Introduction_to_Apex_Code_Test_Methods

 

Bard09Bard09

I did a search for the word "component" and didn't find anything on that page.  Were you referring to the section where they test a Visualforce page by instantiating it and calling its custom controller?

 

If so, can you explain how that'd be adapted to the scenario of a component with a custom controller, instead?  I've tried doing something similar with my test code, but have not had any success so far.

 

 

Bard09Bard09

Shameless bump because I'm still hampered by this problem.  Can anyone assist?