I have an integration test that tests a webflow, whenever it reachs a certain point in the controller code being tested I see an error similar to:
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.codehaus.groovy.grails.webflow.engine.builder.ClosureInvokingAction@ac0e86f in state 'blahQuestions' of flow 'blahBlah' -- action execution attributes were 'map[[empty]]'
at grails.test.WebFlowTestCase.signalEvent(WebFlowTestCase.groovy:142)
at com.blah1.blah2.blah3.blah4.BlahFlowIntegrationTests.testblahQuestions(BlahFlowIntegrationTests.groovy:91)
Caused by: groovy.lang.MissingPropertyException: No such property: blahMessage for class: org.springframework.webflow.core.collection.LocalAttributeMap
at com.blah1.blah2.blah3.blah4.BlahController$_closure2_closure15_closure22.doCall(BlahController.groovy:178)
is thrown by the offending piece: flow.blahMessage = ''
where flow.put('blahMessage', '')
works without errors. This only happens when I run the tests from the command line: grails test-app integration:
, test ran from eclipse RightClick on test -> Run As -> Grails Command (test-app)
work fine.
Grails 2.2.3
Why is this happening and how can I fix it?
Update:
When I run the test via command line by itself the test will pass, but if I run all the integration tests it fails.
Looks like it was test pollution as evidenced by my edit 'When I run the test via command line by itself the test will pass, but if I run all the integration tests it fails'. Turns out other integration tests where using @TestFor
and @Mock
in them, which you should only be using in unit tests.
I figured this out by following Ted Naleid's article 'Fixing Grails Tests That Pass in Isolation but Fail When Run as a Suite' which is exactly what was happening for me. The article provides a groovy class which you can use to find the smallest combination of tests where your test will still fail.