Skip to content Skip to sidebar Skip to footer

Naming Cucumber's Data Table

I am creating test cases on forms that could contains over 50 parameters, some of them would show up when a certain set of questions would be answered specifically. The data table

Solution 1:

It's definitely not possible using the <> syntax.

If you don't have many rows and your main concern is the readability of very wide tables then one option might be "transposing" the table like this:

When I fill in the personal details
    | Field    | Value    |
    | Title    | Prof.    |
    | Surname  | Einstein |
    | ...      |          |

An other option could be to define the recurring set of properties in the Background like this:

Background:
    Given the personal details for'minimal personal details'| Surname |First name || Doe     | John       |And the personal details for'insufficient personal details'|First name || Jack       |And the personal details for'all personal details'
        ...

    ...

    When I fill in personal details using'insufficient personal details'

The bindings of the background register their data in the context and the 'when' binding uses the data from the context.

In either case, you'll need a binding that will tolerate missing properties and catch unknown ones.

Solution 2:

Am not sure about what you are asking but if you are using the same details in different scenarios then it is better to use Background option of Cucumber. So that it will be checked before executing every scenario.

Solution 3:

Tables in Gherkin are a view on the real data (meaning a subset of columns and which rows are of interest). For readability reasons (and that somebody understands what you are doing), you should have at most 7 (plus/minus 2) columns. Maybe, the remaining data can be injected from configuration-files or config-profile database ?!? You basically use the provided Table columns as keys to be able select the configuration-row and to retrieve the remaining data from your configuration-profiles.

Post a Comment for "Naming Cucumber's Data Table"