如何在 cucumber 中传递 boolean 参数用java? 我使用以下带有 boolean 参数的方法:
@Then("test if he is a admin")
public void verify_connect(boolean admin)
{
if(admin)
connectAsAdmin();
else
connectAsUser();
}
最佳答案
使用@ParameterType
https://cucumber.io/docs/cucumber/cucumber-expressions/
@ParameterType(value = "true|True|TRUE|false|False|FALSE")
public Boolean booleanValue(String value) {
return Boolean.valueOf(value);
}
@Then("Something is set to {booleanValue}")
public void somethingIsSetTo(Boolean value) {
}
关于java - 如何用java在cucumber中传递 boolean 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57415985/