How to retrieve multiple test data from excel?

Ask general questions here.
Posts: 3
Joined: Wed Jun 15, 2016 8:03 am

How to retrieve multiple test data from excel?

Post by Dinesh27 » Wed Jun 15, 2016 8:25 am

Is there any way, where I can retrieve multiple test data based on the excel screenshot I have attached without using inbuilt UI for data binding?

When I run the code, the code should interlink between the test case name and with its own set of test data.
Iteration should happen based on count of test data of each test case without UI support. How to write a code for this?
Excel- Test Case and its relevant test data
TestData.png (148.83 KiB) Viewed 849 times

User avatar
Ranorex Guru
Ranorex Guru
Posts: 4662
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to retrieve multiple test data from excel?

Post by odklizec » Fri Jun 17, 2016 7:59 am

Hi Dinesh,

Is there any particular reason, why you cannot put each table to its own excel worksheet? How I see it, your existing worksheet contains three separate data tables for three separate test cases, right? So why not to make your life easier and create three separate worksheets and three separate data connectors, using built-in data binding functionality?

If I were you, I would use code only if there is no built-in or better/faster way to achieve what you want with existing Ranorex functionality. The more code you add to your tests, the higher probability your tests will fail at some point ;) But even if you insist on using coded way, it would be much easier to use separate worksheets instead of single one.

If you still think you can do it better in code, then you need to use
Ranorex.Core.Data.ExcelDataConnector, where you can define range of cells for given excel file and worksheet.

An example how to use ExcelDataConnector can be found for example here: ... tml#p23324

But I think it will not work with single worksheet anyway (even if you define worksheet range), because there are three separate headers for each test data? So you will still need to use three separate worksheets.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration