【发布时间】:2018-04-16 18:01:37
【问题描述】:
我想我正在从here 复制答案,但我仍然无法让可选参数起作用。这两个步骤独立运行,我只是想尝试将它们结合起来。
场景:
然后(~/^set timeout(?: at (\d+) (min|hr))?$/) { int duration , String units ->
为
工作并将超时设置为 30 分钟
但不适用于:
并设置超时
哪个会抛出这个错误
groovy.lang.MissingMethodException: 没有方法签名: CucumberTestSteps$_run_closure56.doCall() 适用于参数类型: (null, null) 值: [null, null] 可能的解决方案:doCall(int, java.lang.String), findAll(), findAll()
我已经尝试了其他几个随机位置的 '?:' 和 '?'没有运气。此外,几个返回到该语法的网络搜索也应该可以工作。
Cucumber 将其识别为有效测试,因为当我添加时
那么(~/^设置超时$/)
它将其识别为重复步骤
cucumber.runtime.AmbiguousStepDefinitionsException: ✽.Then set timeout(test.feature:57) 匹配多个步骤定义: 在 CucumberTestSteps.groovy:1128 中设置超时 ^set timeout(?: at (\d+) (min|hr))?$ in CucumberTestSteps.groovy:1148
【问题讨论】: