Cucumber不识别String参数,我想用它作为货币。它只识别int值。(它会找到这些步骤,因为其他步骤也可以工作)
@When("I deposit {int} of {string}")
public void testDeposit(int value, String currency) throws ClientProtocolException, IOException {
它显示以下错误消息:
There were undefined steps. You can implement missing steps with the snippets below:
@When("I deposit {int} of GBP")
public void i_deposit_of_GBP(Integer int1) {
// Write code here that turns the phrase above into concrete actions
throw new cucumber.api.PendingException();
}
@Then("My balance is {int} of GBP")
public void my_balance_is_of_GBP(Integer int1) {
// Write code here that turns the phrase above into concrete actions
throw new cucumber.api.PendingException();
}
- 因为我创建了一个帐户
- 当我存款100英镑时
- 那么我的余额是100英镑
有什么问题吗?
1条答案
按热度按时间lf5gs5x21#
从https://cucumber.io/docs/cucumber/cucumber-expressions/
{string}匹配单引号或双引号字符串,例如“banana split”或“banana split”(但不是banana split)。
对于没有引号(也没有空格)的货币代码,您需要
{word}
,因此: