Anji R
Anji R

Reputation: 963

Data driven testing in Cucumber using Excel sheets

We want to implement data driven testing in Cucumber using external files like excel sheets without using DataTable or Examples keyword provided by Cucumber.

here is my feature file

Feature : verify login page Scenario Outline: Data Driven with excel and data sets

When I am the Login Page Then I input username and passwords with excel row "<row_index>" dataset

Examples:
| row_index  |
| 1          |
| 2          |
| 3          |
| 4          |

in the above example we are reading data from excel based on the row index provided in file.

it is difficult to write those many records in the feature file as the data will be getting added dynamically (no of rows to test will be increasing) and we need to modify feature file each and every time.

is there any way to read the data from external files like excels so that we can keep test data separately from scenarios and do data driven testing.

Any guide or advise on it would be of great help

Thanks, anji

Upvotes: 1

Views: 5886

Answers (1)

diabolist
diabolist

Reputation: 4099

There is no point in using Cucumber if you are going to drive tests with Excel spreadsheets. Instead write a Unit test, then you will be writing code and be in a programming language so you can load spreadsheets into data structures and iterate through them to carry out your tests.

Upvotes: 3

Related Questions