I have a Visualforce page and controller that calls a flow. I have only been able to get 7% test coverage. Is it possible to get more coverage even though you can't start the flow?

Visualforce Page:

 <apex:page Controller="QuoteFlowController"> 
    <flow:interview name="Q2C_Quote" interview="{!myFlow}" finishlocation="   {!QID}"/>  


public class QuoteFlowController {
    public Flow.Interview.Q2C_Quote myFlow {get; set;}

public String getmyID() {  
   string returnURL = null;
            returnURL = '/'+ myFlow.varOppID;
        else if(myFlow.varServiceOnly==true){
             returnURL='/'+ myFlow.varQuoteID;
            returnURL= '/'+ myFlow.varQuoteID+'/e?retURL=/'+myFlow.varQuoteID;
    return returnURL;

public PageReference getQID(){   
    PageReference p = new PageReference(getmyID());
    return p;

Unit Test:

@isTest (SeeAllData=true)
public class QuoteFlowControllerTest {
    static testMethod void QuoteFlowTest(){
        PageReference pageRef = Page.RedirectQuote;

        QuoteFlowController qfc = new QuoteFlowController();
        qfc.myFlow = new Flow.Interview.Q2C_Quote(new Map<String, Object>());
  • 1
    Related: Unit Test for Controller that Calls a Flow Aug 4 '16 at 15:49
  • Based on the related, it seems there is no way to test this?
    – user35075
    Aug 8 '16 at 14:28
  • "I'm assuming your flow is an interactive flow? If so, you can't test it. If it is a trigger-ready flow, then you need to use the start() method to trigger the flow." Aug 8 '16 at 14:29
  • It is an interactive flow. Thank you for your help.
    – user35075
    Aug 8 '16 at 17:09

Your Answer

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

Browse other questions tagged or ask your own question.