Skip to main content
Lourdes Montero 님이 #Apex에 질문했습니다
I have created a Flow that creates a "quick case". I have a VisualForce page that has a "Quick_Case" apex class as a controller that gets the Flow and returns the landing page once the case is submitted.The problem is that I am trying to deploy this in production, but I need code coverage for the apex class.

Visualforce Page:

<apex:page controller="Quick_Case" >

<flow:interview name="Quick_Case" interview="{!flowInstance}" finishLocation="{!FinishLocation}" buttonLocation="bottom">

<apex:param name="Role" value="{!$User.UserRoleId}"/>

<apex:param name="Department" value="{!$User.Department}"/>

<apex:param name="CurrUserID" value="{!$User.Id}"/>

</flow:interview>

Apex Class:

public class Quick_Case {

Public Flow.Interview.Quick_Case flowInstance{get; set;}

Public PageReference getFinishLocation(){

String ID = '';

if(flowInstance != null)

ID = flowInstance.caseid;

PageReference send = new PageReference('/' + ID);

send.setRedirect(true);

return send;

}}

I just do not know how to make the test class in this situation. I appreciate any help.
답변 1개
  1. 2015년 9월 4일 오후 8:13
    The kicker is that Flow requires user intervention, so it becomes a challenge to run via Unit Test.  You may want to refactor your code a bit so you can set the "Id" variable via your Unit Test, as well as instanciate "flowInstance" to bypass line 8.
0/9000