Hi Mauro,
On 2009-10-23 01.29, Mauro Talevi wrote:
at the moment the candidate steps that are constructed from the Steps
class do not carry with them the annotation which denotes the type of
step. They simply hold the pattern and check that the string step that
is provided to them for matching starts with one of the allowed starting
words (Given/When/Then/And or equivalent in other locales).
Hence, a behaviour such as you've hit upon is possible, albeit may not
be desirable from you point of view. I personally would not define it a
bug, but as the old saying says: "one man's ceiling is another man's
floor" :-)
So you're saying there's a benefit to this behaviour? If so, I'm curious
to know in what way it is good. To me, right now, it just seems
confusing. I would prefer if words have meanings. Makes them easier to
use in my experience.
One immediate workaround is to slightly reword your steps so that
matching pattern is unique , e.g.
Given foo named Bar
...
When foo is cretaed with named Xyzzy
And this is what I have done. But I had to spend quite a lot of time
debugging my code, looking at test cases that sometimes works, and
sometimes don't work, because of this unexpected "behaviour". And then
to find that this design seems to be intentional - that words don't have
any meaning - was puzzling, especially in a BDD-project. Am I the only
one seeing a wee bit of irony here?
If you want to keep this behaviour, where words have no meaning, why not
simply replace all the annotations with @Generic. Then there would be
less of a learning curve! Just one annotation to learn!
The idea behind the current implementation was that the uniqueness of
the matching pattern would be sufficient, given that the language
typically is different in step of different types. The enhancement that
would satisfy your use case is that it should be unique for each given
step type or annotation.
Yes, that would be appreciated.
But, as always we're driven by user requests and use cases. Why don't
you raise an enhancement request in Jira and we'll evaluate the impact
and backward compatibility. OTOH, I don't see any serious obstacles to
this kind of change, but I would to look into in a bit more detail
before giving a definite answer.
Sure, I've filed JBEHAVE-196: Words should have meanings.
/Rickard
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email