TestNG testing framework — Parameterization with Excel

Arvind Choudhary
2 min readMay 18, 2022
TestNG
TestNG

Why use Excel?

Microsoft Excel is one of the most significant computer programs because of the key role it plays in many sectors. It is the most widely used spreadsheet program in many corporate, classwork and even personal data organization.

Excel stores data in tabular format(i.e. rows and columns). In one workbook we have one or more sheets and each sheet is have rows and columns which users could leverage to store data

Excel Snapshot:

testData.xlsx
testData.xlsx

With Apache POI

Apache POI, a project run by the Apache Software Foundation, and previously a sub-project of the Jakarta Project, provides pure Java libraries for reading and writing files in Microsoft Office formats, such as Word, PowerPoint and Excel.(Supports advance operations like merge cells, formating cells,etc.).

Note: use HSSF for .xls & XSSF for .xlsx

Script:

Output:

1.0:test1:abc
2.0:test2:efg
3.0:test3:hij

With Fillo

Fillo is an Excel API for Java and you can query xls & xlsx files. Now, it supports SELECT, UPDATE & INSERT queries with or without WHERE clause.

Script:

Output:

1:test1:abc
2:test2:efg
3:test3:hij

--

--