}
Test Class@isTest(SeeAllData=false)public class OpptyFlowControllerTest {public static testmethod void TheTest() { //Get User ID Id profileId='005D000000Akzri'; //Insert Account Opportunity acct = new Opportunity(Name='VideoKilledTheRadioStar'); acct.Name = 'Test Opportunity'; acct.StageName = 'Long Term Project (180+ days)'; acct.CloseDate = system.today(); acct.Next_Step__c = 'Quote'; acct.AccountID = '001D000000sPSFI'; insert acct; // Retrieve the new Account acct = [SELECT Id,Name FROM Opportunity WHERE Id =:acct.Id]; Quote Qt = new Quote(name='TestClassQuote'); qt.F_A_O__c = 'EA'; qt.OpportunityId = acct.ID; insert Qt; Qt = [Select ID, Name From Quote Where Id =:Qt.ID]; SPA__c SPA = New SPA__c (name='TestClassSPA'); Insert SPA; SPA = [Select ID, Name From SPA__c Where ID =:SPA.ID]; String OpptyID = acct.Id; System.debug(OpptyID); ApexPages.StandardController sc = new ApexPages.StandardController(acct); OpptyFlowController ec = new OpptyFlowController(sc); PageReference FlowContractPageRef = Page.OQS_Flow_VF_Page; Test.setCurrentPage(FlowContractPageRef); string Var_NewOpptyID=opptyID; ec.getOID(); ec.getmyID(); System.test.startTest(); System.debug('myID - Add myID'); System.debug('myID - Save'); System.test.stopTest(); }}Hi Brian, Let me know if the below covers the NewContact() method now
Regards, Anudeep@isTest(SeeAllData=false)
public class OpptyFlowControllerTest {
public static testmethod void TheTest() {
//Get User ID
Id profileId='005D000000Akzri';
//Insert Account
Opportunity acct = new Opportunity(Name='VideoKilledTheRadioStar');
acct.Name = 'Test Opportunity';
acct.StageName = 'Long Term Project (180+ days)';
acct.CloseDate = system.today();
acct.Next_Step__c = 'Quote';
acct.AccountID = '001D000000sPSFI';
insert acct;
// Retrieve the new Account
acct = [SELECT Id,Name FROM Opportunity WHERE Id =:acct.Id];
Quote Qt = new Quote(name='TestClassQuote');
qt.F_A_O__c = 'EA';
qt.OpportunityId = acct.ID;
insert Qt;
Qt = [Select ID, Name From Quote Where Id =:Qt.ID];
SPA__c SPA = New SPA__c (name='TestClassSPA');
Insert SPA;
SPA = [Select ID, Name From SPA__c Where ID =:SPA.ID];
String OpptyID = acct.Id;
System.debug(OpptyID);
ApexPages.StandardController sc = new ApexPages.StandardController(acct);
OpptyFlowController ec = new OpptyFlowController(sc);
ec.NewContact();
PageReference FlowContractPageRef = Page.OQS_Flow_VF_Page;
Test.setCurrentPage(FlowContractPageRef);
string Var_NewOpptyID=opptyID;
ec.getOID();
ec.getmyID();
System.test.startTest();
System.debug('myID - Add myID');
System.debug('myID - Save');
System.test.stopTest();
}
}