[
http://jira.codehaus.org/browse/JBEHAVE-130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=189073#action_189073
]
Mauro Talevi commented on JBEHAVE-130:
--------------------------------------
After pairing at Agile2009 with Paul, we introduced a new optional table
section in the scenario which includes all the replaceable values of a scenario
template. E.g.:
Given some stocks of <prices> and a <threshold>
When one of these stocks is traded at <price>
Then the trader is alerted with <status>
Examples:
|prices|threshold|price|status|
|0.5,1.0|15.0|5.0|OFF|
|0.5,1.0|15.0|11.0|OFF|
|0.5,1.0|15.0|16.0|ON|
The presence of the Examples: keyword (which must be found after the steps at
the end of the parseable portion of each scenario) triggers the execution of
the scenario for as many times as the number of table data lines (i.e.
excluding the first header line).
Note that the presence of <> is purely conventional, as it signals to the
scenario writer that the parameter value will be picked up from the table.
The parameters are injected via @Named annotations, e.g.:
@Given("some stocks of <prices> and a <threshold>")
public void pricesWithThreshold(@Named("prices") List<Double> prices,
@Named("threshold") double threshold) {
// ...
}
and it's the value of the @Named annotation that is used to read the value from
the table.
Next step, is to have a similar mechanism at play using paranamer instead of
annotations, so to offer developers the choice between the annotation-based and
convention-based approaches.
> Other examples include
> ----------------------
>
> Key: JBEHAVE-130
> URL: http://jira.codehaus.org/browse/JBEHAVE-130
> Project: JBehave
> Issue Type: New Feature
> Components: Core
> Reporter: Elizabeth Keogh
> Assignee: Mauro Talevi
> Fix For: 2.3
>
>
> Antony and other Fitnesse / Concordion users would like something along these
> lines:
> Given a user Fred Bloggs with username fbloggs and password Pa55word
> When fbloggs logs in with password Pa55word
> Then the page should say "Welcome, Fred Bloggs!"
> Other examples include:
> name | username | password | attempted | message
> --------------------------------------------------------------------------------------------------
> Jane Brown | jbrown | F*bble | F*bble | Welcome, Jane Brown
> Terri Smith | tsmith | W*bble | w*bble | Incorrect
> username or password
> Terri Smith | tsmith | W*bble | W*bble | Welcome, Terri
> Smith
> Fred Bloggs | fbloggs | Pa55word | Password | Incorrect username or
> password
> where the table headings are the same as the parameters in the various steps.
> --
> Reckon this could be done, either by using paranamer or by catching the
> parameter names in the steps (which we don't do at the moment). Shouldn't be
> too hard. Will look at it over the weekend.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email