You need to sign in to do that
Don't have an account?
NikiG22
Test Class
Can someone help me with adding a test class on my controller. thank you!
public class dataTableCon{ public Candidate__c cc{set;get;} public list<Candidate__c> cvd{get;set;} public dataTableCon(ApexPages.StandardController controller) { cvd = new list<Candidate__c>(); cvd = [select Full_Name__c, JobSeeker_Type__c,Years_of_exp__c from Candidate__c ]; }
Thank you again for your help!! I really need to work on my test classes.
here is the final code:
Cheers,
Niki
All Answers
It looks like you just need to create a Candidate__c record and then instantiate an object of your controller class.
static testmethod void testOne() {
Candidate__c candidate = new Candidate__c( Name = 'Test Candidate'
,Field2__c = 'Value2'
, ... );
insert candidate;
dataTableCon dtc = new dataTableCon();
System.assertEquals( 1, dtc.cvd.size() );
}
Hope that helps,
~ Clint
Regards,
joshisrik@gmail.com
Senior Technical Analyst | Schneider Electric.
Ok -I get the following error?
this is what i have:
Sorry, I skimmed over the class. Like Srikant mentioned above you'll need to instantiate a StandardController and pass it to the constructor.
ApexPages.StandardController stc = new ApexPages.StandardController( Candidate__c ); // add this line
dataTableCon dtc = new dataTableCon( stc ); // modify this line to add the standard controller to the constructor
~ Clint
Thank you again for your help!! I really need to work on my test classes.
here is the final code:
Cheers,
Niki
Ok - so i have another project i need help on the test class?i can only get it to 31% and i need it higher so i can move it to Prod.
here is the trigger:
Here is the test class:
please help!
Thanks BillClint.
Check if this increases the coverage.
That moved me to 51% thank you soo much!