Reading data from Excel to DataProvider in Selenium

Reading data from Excel to DataProvider in Selenium

Whenever we wanted to work with a different set of data for executing the same piece of test cases. We need to parametrize our test case where we will pass multiple data to the application at runtime.

Dataprovider is a method for providing data to a test method. This annotated method must return an Object[][] where each Object[] can be assigned the parameter list of the test method.

The @Test method that wants to receive data from this DataProvider needs to use a dataProvider name equals to the name of this annotation.

Here in this example, I would be reading different set of data from excel file which is kept on my local and pass to the application.

Below is the code snapshot where I would be reading data set from my excel file and passing it to search on google home page.

Below is the output of code execution 



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
July 17, 2020 at 8:05 PM

This tutorial was very helpful. Thank You