cabbage-ex / cabbage

Story BDD tool for executing elixir in ExUnit
MIT License
141 stars 33 forks source link

Data Tables #18

Closed hisapy closed 7 years ago

hisapy commented 7 years ago
@wip
Feature: Data Tables
  As a developer
  I want support for Data Tables 
  So I can get a list of values inside a step definition

Scenario: Data table represented as a list of maps
  Given the following data table
  | id  |  name  |
  | 1    | Luke    |
  | 2   | Darth   |
  When I run a the test file
  Then in the step definition I should get a var with the value
  """
  [%{id: "1", name: "Luke"}, %{id: "2", name: "Darth"}]
  """

Notice: I don't know if Cabbage currently support multiline strings. For more info see: https://cucumber.io/docs/reference#data-tables

rawkode commented 7 years ago

Have you looked at https://github.com/cabbage-ex/cabbage/blob/master/test/features/coffee_outline.feature?

hisapy commented 7 years ago

No I haven't but now that I have, I see is not the same as data tables. In the coffee example, the scenario is run with different values instead of making the step receive a "list" or "table"

mgwidmann commented 7 years ago

So those are scenario outlines, which rerun the test with variables filled in. What hes asking for is also kind of necessary in order to do something like creating a user with specific attributes. I believe gherkin has support for data tables, we'd need to add a test and what it does and if there are any tweaks necessary on this side of things.