I am trying to figure out how to use the "ExcelDataConnector" class in Ranorex to access Excel data so we can build dynamic test case interaction.
ExcelDataConnector con;
con = new ExcelDataConnector("Test", "C:\\Users\\jonas\\Desktop\\Test.xlsx", "Setup", "", 0);
Report.Info(con.FileName);
So I think I have connected to the DataSource. But what do I do from here?
I am looking at the documentation, but I can't figure out what methods to use to fetch the data or loop through records.
Or am I completely out of context here?
I am starting to get the feeling that I have misunderstood the class and what to use it for.
If anyone can confirm or deny my suspicion I would be grateful. And if this is how you are supposed to use the class, please provide a few examples to get me going.
This has great information: 10 Best Practices in Test Automation #5: Data-Driven Testing.
This is just a sample of what you can see there:
public ExcelConnector(string excelFile, string[] inputs, string[] outputs, bool load, UInt16 startRow)
{
this.excelFile = excelFile;
this.inputs = inputs;
this.outputs = outputs;
if (load)
this.LoadFile();
currentRowIndex = startRow;
}
public void LoadFile()
{
excelObj = new Excel.Application();
System.Threading.Thread.CurrentThread.CurrentCulture = new
System.Globalization.CultureInfo("en-US");
workBook = excelObj.Workbooks.Open(this.excelFile, 0, true, 5, "", "", true,
Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, false, false);
Excel.Sheets sheets = workBook.Worksheets;
worksheet = (Excel.Worksheet)sheets.get_Item(1);
}