Announcement Announcement Module
Collapse
No announcement yet.
Output of Spring Webflow in Junit Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Output of Spring Webflow in Junit

    I have a Junit written for a Spring Webflow. The Junit works fine but I need to check the values of the output of the webflow. How can we get those in my Junit class? See the below workflow. How can I get the value out_object in my Junit test case?

    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
    xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance"
    ns0:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
    start-state="start">

    <action-state id="start">
    ....
    </action-state>

    <view-state id="showSomething" view="showView">
    <transition on="save" to="store">
    </transition>
    <transition on="cancel" to="end"/>
    </view-state>

    <action-state id="store">
    do something the storing stuff and transition to finish
    <transition to="finish"/>
    </action-state>

    <end-state id="cancel"/>

    <output name="out_object" value="flowScope.outputObject"/>

    </flow>

    Thanks in advance.
    Nitin

  • #2
    Originally posted by nitindabadghav View Post
    How can I get the value out_object in my Junit test case?
    Try registering a FlowExecutionListener (subclass FlowExecutionListenerAdapter) implementing 'sessionEnded' as an inner class of your JUnit test suite and assert the k/v pairs of the attribute map 'output' within it.

    Comment


    • #3
      got it working

      Eventually I got it working yesterday in the below way :

      LocalAttributeMap outputVariables = (LocalAttributeMap)getFlowExecutionOutcome().getOu tput();

      This returned me the value of the output parameters of the webflow.

      Thanks anyways

      Regards,
      Nitin

      Comment


      • #4
        Great. I had been using my approach previously, however yours is more concise!

        Comment

        Working...
        X