How to read excel file in cucumber project?

30,457

If you use CucumberJVM, I don't think you can make use of TestNG Data Providers without major hacks. Or at least this is not a "cucumber way" of doing things. Data Table is a Cucumber equivalent of TestNG Data Provider:

https://cucumber.io/docs/reference#data-tables

This is how you parametrise tests in Cucumber. I'm not saying the solution you are looking for can't be implemented, I'm saying you are most likely looking for a wrong thing. CucumberJVM makes use of DataProviders internally, to handle features this way:

https://github.com/cucumber/cucumber-jvm/blob/master/testng/src/main/java/cucumber/api/testng/AbstractTestNGCucumberTests.java

Share:
30,457
bugCracker
Author by

bugCracker

Software Test Engineer (ISTQB Certified)

Updated on July 10, 2021

Comments

  • bugCracker
    bugCracker almost 3 years

    I am creating testing automation framework using java but i am not able to read excel file in cucumber.

    is there any way to use @DataProvider functionality og testNG?

    I do not want to use datatable of feature file.