How can I pass a Boolean parameter in cucumber with java? I hava the following method with a Boolean parameter:
@Then("test if he is a admin")
public void verify_connect(boolean admin)
{
if(admin)
connectAsAdmin();
else
connectAsUser();
}
Use @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) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With