Question

I'm trying to write unit test for a flow, which has subflow, which, itself, has another subflow.

I register first flow using FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory).

Then I register subflow definitions during test execution in FlowDefinitionRegistry before transitioning to them.

Transitioning to "first level" subflow goes ok. The result of transitioning to subflow of current subflow - NoSuchFlowDefinitionException.

The problem is that subflow definitions are all seem attached to the primary flow of the test and subflow can't be found within another subflow.

Is there any way to attach subflow definition to another subflow in tests, which extend AbstractXmlFlowExecutionTests?

Was it helpful?

Solution

You should test every flow alone. So first time test top flow and mock first subflow, then test only first subflow and mock second one and so on...

http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch15s07.html

OTHER TIPS

I think this is possible, but a little convoluted to get right.

Have a look at this thread: Testing a flow with subflow doesn't work. The bottom line answer appears to be: override the configureFlowBuilderContext(MockFlowBuilderContext builderContext) virtual method and register your mock in there.

This JIRA case for the Spring framework touches on this issue and also suggests it's possible but convoluted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top