I do know that basically all Given, When, Then and And keywords in feature definition technically are not distinguished by . But why does have different for the step definitions @Given, @When, @Then and @And?.

What I am observing is either you have the code describing the step:

@When("^first operand = "(.+?)"$")
public void setFirstOperand(String firstOp){
    firstOperand = Integer.parseInt(firstOp);
}

or you have the code:

@Then("^first operand = "(.+?)"$")
public void setFirstOperand(String firstOp){
    firstOperand = Integer.parseInt(firstOp);
}

both execute the logic of the test in the identical way.

Is there any how Cucumber framework treats the code under those different annotations? I believe there should be some difference otherwise this architecture (when you have different entities intended to address the same logic) would not look pretty “object-oriented”.



Source link https://sqa.stackexchange.com/questions/34808/what-is-the-difference-between-given-when-and-then-annotations-in-cucumber

LEAVE A REPLY

Please enter your comment!
Please enter your name here