Announcement Announcement Module
Collapse
No announcement yet.
How do you get webflow unit tests to execute the on-render tag? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do you get webflow unit tests to execute the on-render tag?

    Hi,
    I hope someone can help with this, as its driving me nuts!
    I have a webflow defined as follows:

    Code:
        <view-state id="confirm-details" view="confirm-details">
            <on-entry>
                <set name="flowScope.progressBarState.currentStep"
                     value="T(com.gi.exren.web.actions.FlowConstants).VIEW_STATE_CONFIRM_DETAILS" />
            </on-entry>
            <on-render>
                <evaluate expression="confirmDetailsRenderAction.getCovers()" result="flashScope.renewalCovers" /> 
            </on-render>
    When I start the app server and hit the app with a browser I know the confirmDetailsRenderAction.getCovers() method runs.

    But I want to test this in a junit, and no matter what I try I just cannot get a junit to run anything in the on-render tag

    In my desperation I even changed the bean name in the config to something that doesn't exist:
    Code:
        <view-state id="confirm-details" view="confirm-details">
            <on-entry>
                <set name="flowScope.progressBarState.currentStep"
                     value="T(com.gi.exren.web.actions.FlowConstants).VIEW_STATE_CONFIRM_DETAILS" />
            </on-entry>
            <on-render>
                <evaluate expression="BLAHRenderAction.getCovers()" result="flashScope.renewalCovers" /> 
            </on-render>
    When I subsequently restart the app and hit it with a browser, as expected I get a stack trace saying it can't find the bean:
    Code:
    org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'BLAHRenderActionss' cannot be found on object of type 'org.springframework.webflow.engine.impl.RequestControlContextImpl'
    But then when I run it through my junit class, it doesn't complain or error, which is leading me to think its not running the contents of the on-render at all.

    Is there anything special I have to do when setting up the mockflowcontext or similar to make it execute on-render ??

    Thanks in advance,

    Nathan

  • #2
    Have you found a solution?

    I am facing the same problem. The on-render is executed for the start state but not to for the states where the flow transitions to. The on-entry is executed though. I ended up moving my expression from on-render to on-entry, given that the results of its execution would not change dynamically.

    Comment

    Working...
    X