Extending Gherkin?

804 views
Skip to first unread message

Gáspár Nagy

unread,
Nov 2, 2009, 11:16:18 AM11/2/09
to SpecFlow
In some cases, the Gherkin format seems to be not so well fitting. We
were thinking on extending the Gherkin format to support these
scenarios better.

I would like to kick-off a discussion about these potential
extensions. Please feel free to comment or extend the list. (I'm not
sure what is the best format to discuss these.)

Here is my list:

1. hierarchical (nested) table arguments.
In many cases, we need to represent a hierarchical data structure in a
step, like for creating 3 orders with some order lines for each. For
that some nested-table definition would be more efficient. I don't
know how it should look like. My idea was to represent it with double
pipe signs (||), like this

Given the following orders in the database:
| date | customer | orders |
| 2009/11/02 | cust1 | => (some special sign) |
|| product || quantity || price ||
|| Tofu || 3 || 23 ||
|| X || 4 || 42 ||
| 2009/11/02 | cust2 | => |
|| product || quantity || price ||
|| Tofu || 3 || 23 ||
|| X || 4 || 42 ||
| 2009/11/02 | cust3 | => |
|| product || quantity || price ||
|| Tofu || 3 || 23 ||
|| X || 4 || 42 ||

2. key-value pair arguments
In many cases, you need to specify multiple property for a step, and
therefore you use a table argument with a single row (actually 2 rows:
1 header + 1 content). The table format for this is quite
inconvenient, maybe this could be supported better:

Given there is a customer in the database with:
>> (some special sign) name = Bob, City = London, Zip = 1234

3. placeholder for a table in a scenario outline
The scenario outlines can only refer to text (string) placeholders. So
you cannot create a scenario outline, like this:

Given there is a customer in the database with:
<customerTable>

Some possibility for describing <customerTable> variants in the
"Scenarios/Examples" block would be fine. Of course if there would be
nested tables (see 1), this could obviously work.

Reply all
Reply to author
Forward
0 new messages