cucumber - Conditional Inputs? -
i'm trying write cucumber test part of our application (i'm new cucumber, , writing acceptance tests really), , have step in test, want 1 of 2 different things. want either check specific value, or check system default value.
this came with
scenario outline: english news given locale set '<language>' when user views page see <image> image examples: | language | image | | en-gb | default | | fr | "french.png" |
this hits 1 of 2 different step definitions,
@and("^they see default image$") public void defaultimage() throws throwable { // check system default } @and("^they see \"(.*)\" image$") public void customimage(string image) throws throwable { // check specific value input }
is correct way this? tl has suggested should have 1 step def, , pass "default" input, , conditional check inside step def, this:
@and("^they see \"(.*)\" image$") public void checkimage(string image) throws throwable { if ("default".equals(image)){ // check system default } else { // check specific value input } }
which correct way this? appreciated.
your default image must have real name, right ? why not validating real name ? because "default" not may understand same thing.
if this, indeed need 1 step def. wouldn't put if check, assert real name. can maybe add comment in example table saying first value default, it's clear in team.
Comments
Post a Comment