As the free text parameter, there is another special parameter that can be used in CucumberStudio: the step datatable.
This kind of parameter can be added from a step by clicking on the menu and selecting Add table parameter to create a step datatable parameter.
Let’s consider the following scenario:
We need to provide CucumberStudio the list of existing users in the system. This could be done by using the scenario datatable but it would generate multiple tests and use only one row by test.
We can use a step datatable to fix that problem:
As with the Gherkin syntax, CucumberStudio expects a table formatted with
The table is set as an action word argument. The test case will look like this:
If we have a look at the action word, we can see that it has now a
|As with the free text parameter, it is mandatory to keep the name
__datatable, otherwise it will not behave as a table but as a classic parameter.
Automating the datatable
When exporting the tests with non-Gherkin based test frameworks, the datatable is passed to the action word as a string.
You will have to implement your own way to handle the data, but the code is pretty simple (here is a Ruby-ish treatment):
line.split("|").map do |cell|
cell.trim() // trim removes white spaces around the content
The Gherkin based frameworks (Cucumber, Behave, Behat, Specflow) will handle the datatable and already provide you ways to access rows and cells.
One known issue with the code generation occurs with Specflow and Cucumber/Java. The generated steps_definitions file will be correct (by giving the Table or DataTable type to the datatable parameter) but the corresponding action word will consider the parameter as a string. This needs to be manually corrected while implementing the action word.