You need to sign in to do that
Don't have an account?
Jordan Frank
Custom Controller Testing
Hey Guys,
Very new to the apex/custom controller world, in fact this is my first one. I am building a custom dashboard filled with VF pages that call a custom controller. The controller works as expected but I cannot deploy and more change sets to production because my code coverage is too low. I did not realize I have to build a test class in order to keep that code coverage from returning 0... Here is my custom controller, can someone help me understand how I would write a test class for this? Thanks!
Very new to the apex/custom controller world, in fact this is my first one. I am building a custom dashboard filled with VF pages that call a custom controller. The controller works as expected but I cannot deploy and more change sets to production because my code coverage is too low. I did not realize I have to build a test class in order to keep that code coverage from returning 0... Here is my custom controller, can someone help me understand how I would write a test class for this? Thanks!
public class retrieveBS { public String getEngineerName() { return 'Bob Smith'; } public List<Opportunity> getOpportunities() { return [Select Opportunity.Account.name, StageName, Name, Job_Num__c, Project_Sponsor__c, Project_Manager1__c, MHE_Engineer__c, MHE_Engineer2__c, SDS_Engineer__c, Software_Engineer__c, SH_Assigned__c FROM Opportunity WHERE (Project_Sponsor__c = 'Bob Smith' OR Project_Manager1__c = 'Bob Smith' OR MHE_Engineer__c = 'Bob Smith' OR MHE_Engineer2__c = 'Bob Smith' OR SDS_Engineer__c = 'Bob Smith' OR Software_Engineer__c = 'Bob Smith') AND (StageName = 'Application Engineering' OR StageName = 'Commitment to Buy' OR StageName = 'Closed Won') AND (Execution_Status__c = 'Active' OR Execution_Status__c = 'Implementation' OR (Proposal_Status__c = 'Active' AND RecordTypeID = '0121a000000RLqA')) limit 10]; } }
Let us know if this will help you
All Answers
Let us know if this will help you