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
MikeGillMikeGill 

Test Controller Extension

Completely stuck on how to test this. All the posts I have read are very confusing

 

 

public  class PreloadVacancy {

	public PreloadVacancy(ApexPages.StandardController vacancy){
		
		Vacancy__c plVacancy = (Vacancy__c) vacancy.getRecord();
		plVacancy.Account__c = ApexPages.currentPage().getParameters().get('acc');
		plVacancy.Order__c = ApexPages.currentPage().getParameters().get('ord');
		plVacancy.Credit__c = ApexPages.currentPage().getParameters().get('cred');
		plVacancy.Contract__c = ApexPages.currentPage().getParameters().get('con');
			
	}
	

}

 

I understand how testing works from a trigger perspective. But have no idea on controllers. Interestingly enough this is deployed in production with 0% converage.

 

Any pointers welcome.

 

Anand@SAASAnand@SAAS

Check out the documentation at http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_error_handling.htm.

 

It's possible that the coverage of all classes (including the one that had 0%) was above 75%. Salesforce requires the overall test coverage to be atleast 75%. However the good practice is to ensure that each apex class has atleast 75% so that future deployments don't have any issues.

guest1231231guest1231231

That documentation link is broken.