我有以下场景大纲
Background:
Given customer is in hot or not page
Scenario Outline: Hot article
And customer enters <name>
And submits
And customer clicks thumbs up
Then ensure the TBD
Examples:
| name |
| Elliot |
| Florian |
以及后续步骤实施 -
@And("customer enters <name>")
public void customer_enters_name(String name) throws Throwable {
// Express the Regexp above with the code you wish you had
Thread.sleep(10000);
}
但是当我执行测试时,我得到以下错误 -
您可以使用以下代码段实现缺少的步骤:
@Given("^customer enters Elliot$")
public void customer_enters_Elliot() throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
@Given("^customer enters Florian$")
public void customer_enters_Florian() throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
我是否错误地执行了测试步骤?
答案 0 :(得分:1)
而不是
Scenario Outline: ...
And customer enters <name>
...
这样做(注意双引号)
Scenario Outline: ...
And customer enters "<name>"
...
答案 1 :(得分:0)
添加,在跑步者类中出现同样的错误,我们把步骤类的错误包装
@CucumberOptions(glue = {"com.wrongpackage.step"})
public class TestRunner{
}
应该存在步骤类,包应该是正确的。