1

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

1
  • Not sure about mixing cucumber with large datasets. Still you should have a look at Apache POI to access excel from java. Use a before hook with the appropriate scenario tag as value to access excel files and store data in lists etc, then in the step code you will need to access the list. Should give you better performance. Commented Oct 10, 2017 at 7:49

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.