Announcement Announcement Module
No announcement yet.
Adding a JUnit Test class for webflow Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding a JUnit Test class for webflow

    I have yet to use junit *gasp*. Yeah its sad but true. Anybody know where a good reference on how to setup tests for a spring webflow project (one that uses eclipse would be even better). I understand the basics of setting up a test class to test another class, but I am having trouble wrapping my head around creating a test class that travels through the flow. I made the following class (copied from the api and modified for my use):

    package com.xactsites.producty.tests;
    import org.springframework.webflow.execution.ViewSelection;
    import org.springframework.webflow.test.MockParameterMap;
    import org.springframework.webflow.test.execution.AbstractXmlFlowExecutionTests;
    import org.springframework.webflow.definition.registry.FlowDefinitionResource;
    public class InterviewFlowTests extends AbstractXmlFlowExecutionTests
    	protected FlowDefinitionResource getFlowDefinitionResource() 
            return createFlowDefinitionResource("src/mypath/to/flow.xml");
        public void testStartFlow() 
        public void testDisplayCriteriaSubmitSuccess() 
            MockParameterMap parameters = new MockParameterMap();
            parameters.put("XT_NAME", "tad");
            parameters.put("XT_YEAR_BUILT", "2002");
            ViewSelection view = signalEvent("next", parameters);
    Now I am confused as to how to get this to run using eclipse. Yes its a newbie question and I want to learn more so just direct me to some good references and I will do all the learning. I have found plenty of junit tutorials but still do not understand how to get it working with spring webflow. Thanks in advance.

  • #2
    What problems are you having when running the example?

    Does it run at all?
    Is there an exception?

    Be more specfic about your problems please.


    • #3

      Sorry about that. I am not sure how to run it. What I am asking for is some tutorial or explaination on how to take this class an turn it into a junit test in eclipse. Its not getting any errors because I simply don't know where to start. How do I add it as a junit test in eclipse.


      • #4

        Wow...that was incredibley simple! Right as junit test...really complicated *cough*. But now it can't find the class.

        Class not found com.xactsites.producty.tests.InterviewFlowTests
        java.lang.ClassNotFoundException: com.xactsites.producty.tests.InterviewFlowTests
        	at Method)
        The package structure is correct, perhaps I am missing some setup step.


        • #5
          I suggest you go to the eclipse or myeclipse website and look for help/guides there..


          • #6
            I have gone through a bunch of them but still have a number of issues. I finally go frustrated enough to just use ant to do my junit testing and it is working perfectly. Thanks for your responses...sorry I brought it up here in the webflow forum...probably should have gone elsewhere.