I'm all new to Cucumber (jvm) and it all seems lovely and dandy, but:
I really do not know how to have several initial conditions (from different scripts) written in different ways (elegantly) implemented by one method.
eg:
Scenario: I really am bad Given I really am inexperienced with Cucumber When I try to work Then what I produce is of poor quality Scenario: I am on the way to become good (hopefully) Given I am a noob When I learn new things And I practice Then my level improves
Since Given I really am inexperienced with Cucumber and Given I am a cuke noob (although not semantically identical ) are close enough to be implemented in exactly the same way, I would like to be able to associate them with the same method, but
@Given("^I really am inexperienced with Cucumber$") @Given("^I am a cuke noob$") public void checkMyLevelIsGenerallyLow() throws Throwable {
But the code shown here will not compile since the cucumber.api.java.en.@Given annotation is not java.lang.annotation.@Repeatable ...
one simple solution would be to do something like
public void checkMyLevelIsGenerallyLow() throws Throwable {
which will work very well, but will require a lot of code for simple things, and I'm sure there are other ways.
Or even when I asked myself to write down this question: “Am I just approaching this question from the right side?”, Is it that I am trying to achieve even a good idea from the point of view of BDD?
I think this is not so bad, since it is assumed that the ham keeps semantics, and the sentence structure and vocabulary are contradictory (hence the script) dependent. Nevertheless, I should be free from its implementation in any way that I like.
To wrap it all up:
- Should
@Given be @Repeatable ?- If so, why? Is there another way?
- If not, what am I missing in terms of approach?