Page 1 of 1

How to access the column names of the test data files

Posted: Mon May 04, 2015 6:54 pm
by yuanqu
This is related to data driven test.

After added an excel data. I would like to cycle through the columns in the data table and extract the column name.

How do I do this?

Thanks!

Re: How to access the column names of the test data files

Posted: Tue May 05, 2015 9:08 am
by AFI
Try this:

Code: Select all

Ranorex.Core.Testing.ITestCase itc = Ranorex.Core.Testing.TestCase.Current;
Ranorex.Core.Data.ColumnCollection columnc = itc.DataContext.Parent.CurrentRow.Owner.Columns;
foreach(Ranorex.Core.Data.Column col in columnc){
	Report.Info(col.Index + " " + col.Name);
}