If I am building a test class for a custom controller, I generally start like this and I dont have any issues:

CustomControllerExtensionNameccn = new CustomControllerExtensionName();

However, as this custom controller is not an extension of a stadard controller, so the VF page will look like this:

    apex:page controller="CustomControllerName" extensions="CustomControllerExtensionName"

I cant use this system. After many hours of google I only found examples to test for custom controllers that are extensions of an standard controller, but not for custom controller

1 Answer 1


instead of

CustomControllerExtensionNameccn = new CustomControllerExtensionName();

Replace for

    CustomControllerExtensionName ccen = new CustomControllerExtensionName(new CustomControllerName());

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .