Tag: DataTable

Working with multiple data using DataTable in Cucumber for Java

In our last post we discussed getting started with cucumber for Java, in this post we will discuss working with multiple data using DataTable in Cucumber for Java. We have already discussed about working with multiple data in Specflow of C#, which has Table class, but here in Cucumber for Java they have class named DataTable.

Working with multiple data in Cucumber

We might need to supply multiple data instead of hardcoded value passed in steps from feature files, this happens most of the time while working with your project

This can be done using DataTable class available in Cucumber, basically DataTables are of type List<List<String>>

Table in the scenario looks something like this

Here is the complete videos of the above discussion

Working with DataTable using DataTable.raw()

Working with DataTable using custom class

Thanks for reading the post and watching the video!!!

Please leave your comments and let me know if there is anything I should update in this post.

Karthik KK

DDT with Excel in CUIT (Part 1)

We have already discussed Data Driven Testing in Coded UI with CSV in previous post. In previous post we decorated our test method with [DataSource] attribute and used TestContext.DataRow[] method to read data out from CSV file.

But there are some limitation while using DataSource attribute like

  • We don’t have control over the iteration (via code, but we can do via properties)
  • We cannot be very precise about which column and row data we need

Custom data driven library for excel

Hence to overcome to shortcoming of DataSource attribute, we are going to design our own custom data driven library for excel, As always, before starting to create any custom library, it’s always a good practice to first create a design before writing code. Our design looks something like this

Reading and parsing data from excel

Read more