I have a flow, which shows a list of Opportunities, one by one based on score. This flow has been referenced on 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}"/> 

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;
        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.

2 Answers 2


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.


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


  • 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
    Commented Aug 21, 2012 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .