Page Object Model-Testng Parameterization using XML & DataProvider – Data Driven Framework

Reference URL:

For testng Documentation please click on the link Testng Documentation
For Order of Testng Annotations please click on the link http://total-qa.com/testng-introduction/order-of-testng-annotations/
@DataProvider
Marks a method as supplying data for a test method. The 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.
Data Driven Framework



This Framework is one of the Automation Framework useful to execute the test cases using multiple sets of data.
Reference URL for Automation Frameworks: Automation Frameworks

Testng Feature DataProvider – Data Driven Framework

Steps to achieve :

a. Store the input data in an xls file.
b. Read the data from the xls using an third party jar jxl2.6.jar

c. Add the jar to the build path.

  • Workbook contains 3 sheets. They are referred by index / sheet name.
  • Sheet contains rows and columns.
  • We call the data is stored in the excel as cell
  • Store the data into the 2-D array.

d. Store the data in @Dataprovider
e. Use the @Dataprovider in the @Test methods.
JExcel API ->http://jexcelapi.sourceforge.net/resources/javadocs/2_6_10/docs/

Testng Feature DataProvider – Data Driven Framework

Utility Class for Storing Re-Usable Methods





Testng Class for Implementing TestCases
Page Object Reference: //https://github.com/SeleniumHQ/selenium/wiki/PageObjects
Example for Testng Feature DataProvider – Data Driven Framework

Testng Feature DataProvider – Data Driven Framework

Testng Feature DataProvider – Data Driven Framework







Testng XML for Invoking the Class

InputData.xls

Page Object Class-DealsPage.java

Page Object Class-DealsPage.java