-3

I have a scenario to run assertions on the Actual data that is provided in XLS file against the Expected Data provided in XLSX file basing on an identifier column in Java. Can anyone provide any advice or suggestion on this please?

Actual Data

Field(Name) Field(Identifier) Entity(Name) ParentEntity(Name)

Lead time Article.DeliveryTime Item None

Expected Data

Field(Name) Field(Identifier) Entity(Name) ParentEntity(Name)

Lead time Article.DeliveryTime Item ParentQualifier

The number of Rows and columns might change basing on the data provided, but the Field(Identifier) would be given in both the files.

Tester
  • 1
  • 3

1 Answers1

0

I suggest converting the Excel files to some more structured format such as *.csv. You can do that with Excel by just saving it to *.csv. There are many CSV parser libraries. If that is not possible for some reason (not owner of data, management,...) you could use Apache POI to parse the *.xls / *.xlsx files and then do the testing. How to shown here Link1 or here Link2. Then you can simply run the assertions with JUnit.

There are two potential problems though:

  • Changing columns: You need to parse the Excel without specifying exact column names. Then only compare columns that have the same name.

  • Data doesn't fit in memory: Search for id's and only load matching rows.

Terran
  • 1,091
  • 18
  • 29
  • Thank you @Terran. Really appreciate your suggestions here. I will work towards this to achieve the desired output. Thanks again. – Tester Jun 04 '18 at 06:09