function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Suresh(Suri)Suresh(Suri) 

how to cover visual work flow in test class?

Hi any one help to cover myflow!=null. how to pass in test class.

Thanks in advance.

==============Class==============
public Flow.Interview.Case_Flow myFlow {get; set;}

public List<KnowledgeArticleVersion> getArticles()
      {   
           List<KnowledgeArticleVersion> articles;
           articles=new List<KnowledgeArticleVersion>();
           System.debug('****'+status+'****'+lang);
           articleQuery='SELECT Title, Summary, knowledgeArticleID FROM KnowledgeArticleVersion WHERE PublishStatus=:status AND Language = :lang';
           System.debug('******Flow'+myFlow);
          
           if(myFlow!=null)
           {   
            
             String entitle=(String) myFlow.getVariableValue('varPlease_select_customer_s_Product_Details');
            
             System.debug('**EntitleMent'+entitle);               
             if(entitle!=null)
               articleQuery+=' AND title LIKE \'%'+entitle+'%\'';
            
             String laptopIdentity =(String) myFlow.getVariableValue('varWith_regard_to_the_laptop_identify');
             System.debug('****Issues'+laptopIdentity);
             if(laptopIdentity!=null)
                  articleQuery+=' AND SUMMARY LIKE  \'%'+laptopIdentity +'%\'';
                             
            }        
            articles=Database.query(articleQuery);
            return articles;
                      
        }
Vinita_SFDCVinita_SFDC
Hello,

As of now we can not test a visual flow in a test class, it is a limitation.

Refer: https://developer.salesforce.com/forums/ForumsMain?id=906F00000009AfMIAU

http://salesforce.stackexchange.com/questions/562/test-class-for-visual-workflow