Details
-
Type: New Feature
-
Status: Reopened
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 2.4
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
-
Number of attachments :
Description
With the addition of the GivenScenarios feature, almost often will be necessary to inform more than one StepsCandidate class for one Scenario class.
The problem is that those StepsCandidates could have same methods, or could be extending the same parent class and sharing same method.
Jbehave will get the first occurrence of method that match textual sentence, which not necessarily will be the desired one.
So I would like that jbehave had some way to stablish a weight, or an order, or maybe indicate a default steps class (or anything like that) where I could indicate which is the best path it should be taken.
Activity
Mauro Talevi
made changes -
Field | Original Value | New Value |
---|---|---|
Fix Version/s | 2.5 [ 15850 ] | |
Fix Version/s | 2.4 [ 15664 ] |
Mauro Talevi
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Won't Fix [ 2 ] |
Mauro Talevi
made changes -
Resolution | Won't Fix [ 2 ] | |
Status | Resolved [ 5 ] | Reopened [ 4 ] |
Mauro Talevi
made changes -
Fix Version/s | 2.5 [ 15850 ] |
A similar issue comes into play if you have similarly worded steps, like
@When("the user logs in as $user")
@When("the user logs in as $user, with password $password")
If the second step is listed first in the Steps class, it will match
When the user logs in as me, with password xxx
correctly, but if it is second in the file, the first step will be executed with "me, with password xxx" as the user variable. Usually it is more natural to declare steps (java methods in general) in ascending order of complexity.
Perhaps this should be a separate jira ticket, but this could be solved by using non-greedy matching, or, as a bit of a hack, by sorting the annotations in descending string length.