Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Allow parametrisation of scenarios by delimited names
Description
I'm working on a simplification of the current parameterized scenario solution. With this I want to:
avoid the need of defining two different patterns for steps, one for normal scenarios, and another for parameterized scenarios.
be able to use column names in Examples tables that differ from the parameter names that were specified in the step annotation
avoid having to annotate fields with @Named in parameterized step methods
Take the following steps and scenario, for example:
ParameterizedStory.java
parameterized_story.story
The "Given $user is logged in" step pattern will match "Given <client> is logged in", and user parameter will be set to client column values. The main idea is that <client>, instead of represent a named parameter, represents a placeholder, and that placeholder should be replaced with whether value exists for it in the examples table. Then, after replacing the placeholder with the corresponding value, it will then match with the given step pattern, and $user will be set to the correct value.
I'm working on a simplification of the current parameterized scenario solution. With this I want to:
avoid the need of defining two different patterns for steps, one for normal scenarios, and another for parameterized scenarios.
be able to use column names in Examples tables that differ from the parameter names that were specified in the step annotation
avoid having to annotate fields with @Named in parameterized step methods
Take the following steps and scenario, for example:
ParameterizedStory.java
parameterized_story.story
The "Given $user is logged in" step pattern will match "Given <client> is logged in", and user parameter will be set to client column values.
The main idea is that <client>, instead of represent a named parameter, represents a placeholder, and that placeholder should be replaced with whether value exists for it in the examples table. Then, after replacing the placeholder with the corresponding value, it will then match with the given step pattern, and $user will be set to the correct value.
I have a working version available at https://github.com/ruifigueira/jbehave-core/commit/a4107a3ac899c4b952746781f785cba9a97c659c, that can be used to test the scenario above.