Skip to content

Data Tables

Ahmed Ali edited this page Jan 27, 2016 · 3 revisions

##@Everyone

In your step you can pass a table of data. For example:

Given the following accounts exist:
  | name   | email                  |
  | Ahmed  | ahmed@cucumberish.com  |
  | Maikel | maikel@cucumberish.com |

##@Dev For devs. You can define such step as the following:

    Given(@"the following accounts exist", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {
        NSArray * rows = userInfo[@"DataTable"];
    });

Each element in the rows array will contain an array where each element in the sub array is the value of the corresponding column. For the above example your rows variable will have the following structure:

[
   ["name", "email"],
   ["ahmed", "[email protected]"],
   ["maikel", "[email protected]"]
]

So it is up to the developer to treat the first row as the table header or as a data row.

Clone this wiki locally