【发布时间】:2019-11-16 10:40:11
【问题描述】:
我有两个不同班级的一个场景。
我的黄瓜结构:
-
测试类:
@RunWith(Cucumber.class) @CucumberOptions(plugin = "pretty", features = "src\\test\\resources\\samuel\\tripleAnd.feature")//and.feature in first case public class CucumberTest { } -
黄瓜实现:
public class ElementsTestSteps implements En { public ElementsTestSteps() { Given("^Element test$", () -> { }); When("^Using element as \"([^\"]*)\"$", (String arg1) -> { }); //Commented on when using the second scenario When("^Accept (\\d+) (\\d+)$", (Integer arg1, Integer arg2) -> { }); //Commented on when using the first scenario When("^Accept (\\d+) (\\d+)$ (\\d+)$", (Integer arg1, Integer arg2, Integer arg3) -> { }); Then("^Return (\\d+)$", (Integer arg1) -> { }); } } -
当我使用关注
and.feature功能时一切正常:Scenario Outline: Given Element test When Using element as "and" And Accept <switchA> <switchB> Then Return <resultSign> Examples: | switchA | switchB | resultSign | | 1 | 1 | 1 | | 0 | 1 | 0 | | 1 | 1 | 1 | ... -
但是当我使用以下
tripleand.feature功能时,我得到The step is undefined异常:Scenario Outline: Given Element test When Using element as "triple_And" And Accept <switchA> <switchB> <switchC> Then Return <resultSign> Examples: | switchA | switchB | switchC | resultSign | | 1 | 1 | 1 | 1 | | 0 | 1 | 1 | 0 | | 1 | 0 | 1 | 0 | ...
为什么在第一种情况下一切顺利,而在第二种情况下却没有?
【问题讨论】:
-
带有 3 个参数的步骤定义的正则表达式有错误的
$。