erikedin / Behavior.jl

Tool for Behavior Driven Development in Julia
Other
25 stars 3 forks source link

Gherkin: support Data Tables #46

Closed tk3369 closed 3 years ago

tk3369 commented 3 years ago

From Gherkin Reference:

Data Tables are handy for passing a list of values to a step definition:

Given the following users exist:
  | name   | email              | twitter         |
  | Aslak  | aslak@cucumber.io  | @aslak_hellesoy |
  | Julien | julien@cucumber.io | @jbpros         |
  | Matt   | matt@cucumber.io   | @mattwynne      |

Just like Doc Strings, Data Tables will be passed to the step definition as the last argument.

Cucumber provides a rich API for manipulating tables from within step definitions. See the Data Table API reference reference for more details.

It appears that implementation differs in language bindings. For example, the Java implementation maps to a number of data structures. In Python, the behave package simply returns an object that implements some kind of Table API.

To get started, we can probably keep it simple and return an array of named tuples, which already satisfies Tables.jl interface. In the future, we can improve and make it more convenient as described in Data Table API.

Reference: This enhancement is required to support Grakn client. See master issue #44.

erikedin commented 3 years ago

Data tables can now be used. I'll add a section in the documentation on how, but essentially the context object now has a field datatable, which contains the table for that step. I'll close this because there's nothing more specific to do. There are still issues with Scenario Outlines, where placeholders in the data table for a step is not handled, but that's tracked in another issue.