Use datatable

Introduction

Sometimes, you may want to test a behaviour of a feature but for different combination of values:

Do login with vincent@newcorp.com credentials
Do logout
Check that user vincent@newcorp.com is logged out

Do login with john@newcorp.com credentials
Do logout
Check that user john@newcorp.com is logged out

As you can see, if you want to write the same test for other languages, you will have to copy-paste this scenario for each set of values (in the example, the language and the welcoming message)

The datatable is a feature that allow you to execute a single scenario with different values. It avoids duplication of the steps by having separately editable data.

If you are using Gherkin syntax, the datatable is the equivalent of scenario examples. However, unlike regular Gherkin, you can have only one datatable for a scenario in HipTest.

Edit a datatable

Graphic version

Each column represents a datatable parameter. The name of the column is the name of the parameter.

Each row represents a dataset (a set of values) and its cells should not be empty.

Raw version

Using the datatable raw version editor, it is possible to write the examples in Gherkin syntax by editing, or copying and pasting its content:

The raw version editor supports also CSV formatted data. Just paste the CSV content in the editor and it will be automatically formatted.

Use data in steps

Steps are action words

When adding a new step, type the datatable parameter name between double quotation marks:

If you want to use datatable values in an already written step, just fill the parameters fields with the datatable parameter name:

If the step already exists and does not have a parameter, you can add one by renaming it. To do so, type the parameter name between double quotation marks and confirm the renaming. Then, write down the datatable column name in the parameter field:

Steps are action/result

When using action/result, you can use the datatable parameter by using the syntax: ${column_name}

Steps using free text parameter/step datatable

You can use the datatable values in free text parameters and step datatable using the syntax: ${column_name}

Tests generation

When viewing tests, you can switch from a dataset to an other and visualize the scenario with the values of the selected one:

See Generate tests section for more information on the relationship between scenario, datatable and test.

Download the ebook

By submitting this form, you agree to our Terms of Use and Privacy Policy

Hiptest is FREE for open source projects

We actually utilize a number of open source components, which is why Hiptest service is free for any open source project. We are giving back to the community!

Your open source project must meet the following criteria to be approved:

  • Your project is licensed under a license approved by the Open Source Initiative
  • Your project source code is available for download
  • Your project has a publicly accessible website