So, I was looking all over for the opportunity wizard controller test method. There is none, not even salesforce wrote a test wizard for it.
They wrote the controller wizard. Which can be found here:
Opportunity Wizard Controller
I decided to write a test class for it:
Place this within the controller before it ends.
Here it is:
private static testmethod void testnewOpportunityController(){
newOpportunityController controller
= new newOpportunityController();
Account acct = controller.getAccount();
acct.Name='Unit Test Name';
Contact cont = controller.getContact();
cont.LastName = 'Testlast';
cont.Accountid = acct.id;
cont.Email = 'choosepros@gmail.com';
cont.phone = '5551211234';
Opportunity opp = controller.getOpportunity();
opp.Name = 'oppor name';
opp.StageName = 'Prospect';
opp.CloseDate = Date.newInstance(2010,12,31);
OpportunityContactRole oppconrole = controller.getRole();
oppconrole.opportunityid = opp.id;
oppconrole.contactid = cont.id;
controller.cancel();
controller.step1();
controller.step2();
controller.step3();
controller.save();
}
Thanks Check out my Other Salesforce.com Blogs Salesforce Made Easy Salesforce Data Migration Made Easy eTechCareers.com Coming Soon