我正在为 webflow 编写测试,并且我有一个 webflow (A),它在执行过程中调用另一个 webflow (sub-webflow) (B)。如果 A 调用 B,它总是在调用中声明一个必需的参数/输入。单独测试 A 不是问题,但我如何单独测试 B?输入参数状态为:
input {
station(required: true)
}
我尝试从 startFlow() 开始,但这给了我以下异常:
Failure: testCreateWizardSubSubFlow(com.lstelcom.spectraweb.data.EquipmentFlowTests)
org.springframework.webflow.engine.FlowInputMappingException:
Errors occurred during input mapping on startup of the 'createWizardSubSub' flow;
errors = [[RequiredError@51a9e7fc mapping = station -> station, code = 'required', error = true, errorCause = [null], originalValue = [null], mappedValue = [null]]]
at grails.test.WebFlowTestCase.startFlow(WebFlowTestCase.groovy:130)
at com.lstelcom.spectraweb.data.EquipmentFlowTests.testCreateWizardSubSubFlow(EquipmentFlowTests.groovy:38)
WebFlowTestCase
当我收到错误消息时,不存在带有输入参数(例如 startFlow(new Station()) )的 startFlow 方法调用:
groovy.lang.MissingMethodException: No signature of method: com.lstelcom.spectraweb.data.EquipmentFlowTests.startFlow() is applicable for argument types: (com.lstelcom.spectraweb.data.stations.Station) values: []
Possible solutions: getFlow(), getFlow()
at com.lstelcom.spectraweb.data.EquipmentFlowTests.testCreateWizardSubSubFlow(EquipmentFlowTests.groovy:38)
所以问题是如何使用输入参数测试 webflow?