4

I have a flow, which shows a list of Opportunities, one by one based on score. This flow has been referenced in a Visualforce page:

   <apex:page controller="OppPriorityController">
    <h1>Opportunity Prioritisation Wokflow</h1>
    <flow:interview name="Opportunity_Prioritisation_Flow" interview="{!myflow}" buttonLocation="bottom">
     <apex:param name="varCurrentUserID" value="{!$User.Id}"/> 
    </flow:interview>
   </apex:page>

The OppPriorityController is below:

    public class OppPriorityController {

    public Flow.Interview.Opportunity_Prioritisation_Flow myflow { get; set; }
    public String getPhoneNumber() {
             return myflow.PhoneNumber; 
             }
    public String getAccountID() {
             return myflow.AccId;
    }
     public String getAccountName() {
             return myflow.AccountName;
    }
     public String getOpportunityID() {
             return myflow.OppId;
    }
     public String getOpportunityName() {
             return myflow.OppName;
    }
}

The test class which I tried is below:

    @isTest (SeeAllData=true)
private class OppPriorityControllerTest {
    public static testMethod void myTestMethodForFlow() {
        PageReference pageRef = Page.OppPriorityPage;
        Test.setCurrentPage(pageRef);
        OppPriorityController oppPriorityController = new OppPriorityController();        
        oppPriorityController.myflow = new Flow.Interview.Opportunity_Prioritisation_Flow(new Map<String, Object>());
        String pNumber = oppPriorityController.getPhoneNumber();
        String accountId = oppPriorityController.getAccountID() ;
        String accountName = oppPriorityController.getAccountName();
        String opportunityID = oppPriorityController.getOpportunityID();
        String opportunityName = oppPriorityController.getOpportunityName();
    }
}

I received an exception: Interview not started.

Any help would be greatly appreciated.

5

Right now there is no real way to test the controller. You would need an Apex API for Flow to do this, which I am told is something we are working on.

3

If the goal is track how changes might effect the user flow - you might try a Selenium script with it:

http://seleniumhq.org/

  • Thanks for the reply. Nope, the goal is to start the interview from apex class. I believe it is started from VF page by the interview="{!myflow}" tag in: <flow:interview name="Opportunity_Prioritisation_Flow" interview="{!myflow}"> – goabhigo Aug 21 '12 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.