【发布时间】:2015-12-15 12:31:48
【问题描述】:
我在 Java 中使用 Cucumber,并编写了一个将 List 作为参数的场景,即
And the following ids are within the range: 1, 2
这适用于方法定义:
@Given("^the following ids are within the range: (.*)$")
public void ids_are_within_range(List<String> idsWithinRange) {
this.idsWithinRange = idsWithinRange
}
但是,如果我尝试不向列表中传递任何 ID,则会遇到问题:
And the following ids are within the range:
测试根本不执行,并告诉我需要实施相关的测试方法。它认为以列表结尾的行实际上是不带任何参数的不同方法:
Wrong test finished. Last started: [] stopped: Scenario: Search for manifests, none of which are within a date range in the data platform; class org.junit.runner.Description
Test '.Feature: Restful CRUD service for manifest searches.Scenario: Search for manifests, none of which are within a date range in the data platform' ignored
...
You can implement missing steps with the snippets below:
...
@Given("^and the following ids are within the range:$")
如何将空的List 传递到我的方法中?
【问题讨论】:
标签: java cucumber cucumber-jvm gherkin