Details
-
Type: Improvement
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 2.3.2
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
-
Number of attachments :
Description
If the @Named annotation was deprecated, and the $variable patterns were matched to the steps argument list instead, jBehave would be much more usable.
The @Named parameter annotations are in essence redundant, and they limit usability of jBehave for two reasons:
1. The parameter names could be parsed directly from the step scenario instead. And I wish they were: I (and my testers) have frequently run into the problem of the arguments being in the wrong order. An innocent looking step like
@Given("a book $book written by $author") @Alias("$author's book $book") public void setBookAndAuthor(@Named("author") String author, @Named("book") String book) {...}
can lead to great confusion, with the arguments getting switched. Using the step in an example scenario can increase the confusion, as one can legally write:
Given a book [author] written by [book]
Testers and developers alike are also confused that, while Given a book Moby Dick written by Herman Melville works, Given [title] written by [person] doesn't (see next point).
2. they inhibit reusing steps in example scenarios; either that, or they lead to redundant columns.
An example to illustrate this: given
@Given("a stock named $stock") public void createStock(@Named("stock") String stock)...
I cannot reuse this step for two colums in an example:
Scenario: client creates two stocks Given a stock named [A] And a stock named [B] Examples: |A |B | |GOOG | AAPL |
I don't understand. I've been deeply involved in the @Named work and the Paranamer integration (which negates the need for @Named for those who're comfy with the informality it introduces), and don't follow what the issue is. Can we have an attached testcase that fails when it should work ? Thanks.