【发布时间】:2014-12-11 15:30:39
【问题描述】:
我有一个测试 webflow 的集成测试,每当它到达正在测试的控制器代码中的某个点时,我都会看到类似于以下内容的错误:
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)
被有问题的部分抛出:flow.blahMessage = '' 其中flow.put('blahMessage', '') 可以正常工作。这只发生在我从命令行运行测试时:grails test-app integration:,测试从 eclipse 运行 RightClick on test -> Run As -> Grails Command (test-app) 工作正常。
Grails 2.2.3
为什么会发生这种情况,我该如何解决?
更新:
当我通过命令行单独运行测试时,测试将通过,但如果我运行所有集成测试,它会失败。
【问题讨论】:
-
你写道:
Sorry BalRog the typo was my bad on the question, in the actual code they match, I have to modify it per policy, I should have double checked all the spelling.其实我也犯了一个错误。我打算发表我的“答案”作为评论。我现在把它拿下来了。 -
您还写道:
I suspect it is being treated as a fixed-property class I just don't know why since it works fine in the actual code.似乎LocalAttributeMap在其属性集初始化后不允许您添加新属性(映射键)。您是否有可能在一个上下文中实例化为LocalAttributeMap而不是另一个? -
至于两种不同的值设置方式,我运行测试时只有一行是不同的,测试运行之间没有其他代码更改。我使用的是
setCurrentState('blahQuestions'),而不是从头开始。但是,一行代码更改了修复,因此我认为它不相关。
标签: grails integration-testing grails-controller spring-tool-suite syntactic-sugar