6
Vote

Data Driven stories / scenarios

description

Storyq needs a way to run the same story over different parameter datasets. Ideally, we'd aggregate the results (like in Caley's fork) and allow developers complete freedom regarding what the datasource is (passing an IEnumerable<T> would be good).

comments

jlb0001 wrote May 16, 2011 at 9:40 PM

This issue and the initiating discussion thread (http://storyq.codeplex.com/discussions/234652) reminds me of the "Examples" section that has been added to the "Scenario Outline" in Gherkin syntax. For the sake of additional conversation, here are some posts that show how that plays out in the Gherkin syntax. Since one of the goals for StoryQ is to covert from Gherkin, it's not terribly important that we use one style of parameter-driven tests vs another in the generated C# -- whatever works, since it'll be automatically generated most of the time, right?

"Examples" section in "Scenario Outline":
http://railscasts.com/episodes/159-more-on-cucumber
https://rspec.lighthouseapp.com/projects/16211/tickets/274-scenario-outline-ease-writing-examples

In reading about the ways that data tables have evolved in Cucumber / Gherkin, these are the best examples of the syntax I could find that relates to this issue:

https://github.com/cucumber/cucumber/wiki/Multiline-Step-Arguments
https://github.com/cucumber/cucumber/wiki/Scenario-outlines

This quickly gets tangled with another table concept used in Cucumber where the tables are treated as a parameter in and of themselves whereby the entire table is compared as a value (i.e., not used as a substitution data driven table source):

https://github.com/coreyhaines/practice_game_of_life/blob/master/features/multiple_generations.feature
https://github.com/aslakhellesoy/cucumber-rails-test/blob/master/features/manage_lorries.feature

robfe wrote May 16, 2011 at 10:04 PM

Thanks jlb, I was just sitting down to work on this and these examples are very good inspiration.

jlb0001 wrote May 17, 2011 at 5:30 PM

Out of curiosity, does StoryQ use the official Gherkin parser? I noticed that SpecFlow updates this parser with each of their releases.

Gherkin Parser (official .NET implementation):
https://github.com/cucumber/gherkin/blob/master/README.rdoc

robfe wrote May 17, 2011 at 10:56 PM

No, the parser to convert text into StoryQ code is very rudimentary. The parser that creates the StoryQ fluent interface (a t4 template) is a bit different, it's based on Dot (flit.codeplex.com)