Automation of data entry using data from MS Excel

Ask general questions here.
deepalir
Posts: 3
Joined: Tue Feb 24, 2009 1:44 pm

Automation of data entry using data from MS Excel

Post by deepalir » Tue Feb 24, 2009 1:51 pm

Hi,

I'm new to using the Ranorex tool, and have basic knowledge of programming.

I would like to know how to extract data from a .xls or.csv file and pass it into a recorded Ranorex script as test data.

I have looked at & worked the example at http://www.ranorex.com/blog/data-driven ... with-excel, but i would like to completely automate the test and not have to pass the xls file by browsing for the file.

Please do suggest how I can use Excel for data driven testing using Ranorex.

Thanks!

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Wed Feb 25, 2009 3:49 pm

Hi,

How to access a CSV table is described with the installed example project 'DataDriven Test Sample'.

If you're interested in accessing an Excel table directly using the Microsoft Office COM library I suggest to read our online available blog post:

http://www.ranorex.com/blog/data-driven ... with-excel

The example only describes how to access an Excel table. So you need not to implement the same dialog.

If you want to completely automate an Excel based test without having the need to specify the file manually, you'll have to create a Ranorex console application which implements both methods used in our online blog example.

Code: Select all

void InitExcelConnection()
{
	string[] testDataInputs = new string[] { "Input1", "Input2", "Input3", "Input4" };
	string[] testDataOutputs = new string[] { "Output1" };
            
	// specifiy Excel file 
        string myExcelFile = @"C:\temp\myExcelFile.xsl"
	if (System.IO.File.Exists(tbExcelFile.Text))
            excelConnector = new ExcelConnector(this.tbExcelFile.Text, testDataInputs, testDataOutputs, true, 2);

}
Simply copy paste all required classes (ExcelConnector.cs) and methods from the blog example into your Ranorex console project and trigger the test within the static main routine.

kind Regards,

Christoph,
Support Team