Hi Folks,
I have set data source/data bind with excel sheet in a test case.How can I access data source in each iteration in the user code in order to handling some of the data specifically. I just don't know how to get the data source in the test case.
access data/iteration in data driven test case
Re: access data/iteration in data driven test case
I got it. Please add any suggestions and comments.
Looks like I can access DataContext with Ranorex.Core.Testing.TestCase.Current.DataContex
Looks like I can access DataContext with Ranorex.Core.Testing.TestCase.Current.DataContex
Re: access data/iteration in data driven test case
Hi,
Another hint, in case you need to access DataContext from another than current TestCase, you can use this code to do so:
TestSuite.Current.GetTestCase("TestCasename").DataContext
Another hint, in case you need to access DataContext from another than current TestCase, you can use this code to do so:
TestSuite.Current.GetTestCase("TestCasename").DataContext
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: access data/iteration in data driven test case
Can someone check the attached the screenshot for me?
I was trying to access a cell value through row index or column string.
why am I getting "integer expected" in run time?
myDataContext.Source.Rows[1]["GroupName"];
myDataContext.Source.Columns[0]
myDataContext.Source.Columns["GroupName"].ToString();
Thanks,
Betty
I was trying to access a cell value through row index or column string.
why am I getting "integer expected" in run time?
myDataContext.Source.Rows[1]["GroupName"];
myDataContext.Source.Columns[0]
myDataContext.Source.Columns["GroupName"].ToString();
Thanks,
Betty
- Attachments
-
- see "integer expected" in the value column
- 2015-05-DataSourceQuestion.png (16.08 KiB) Viewed 1623 times
Re: access data/iteration in data driven test case
Hello Betty,
It seems you are trying to assign the value in the variable to the column index position. The reason you are getting the “Integer Expected” error is because the value in the variable is stored as a String. You will need to convert the variable to an integer before the assignment.
You could use the below method to do the conversion:
ValueConverter.FromString("GroupName", Int32);
Hope this helps.
Thanks
It seems you are trying to assign the value in the variable to the column index position. The reason you are getting the “Integer Expected” error is because the value in the variable is stored as a String. You will need to convert the variable to an integer before the assignment.
You could use the below method to do the conversion:
ValueConverter.FromString("GroupName", Int32);
Hope this helps.
Thanks
Re: access data/iteration in data driven test case
Starlord,
My code works perfectly fine in the code. The screenshot is from the watch window. I don't get what you mean.
My code works perfectly fine in the code. The screenshot is from the watch window. I don't get what you mean.
Re: access data/iteration in data driven test case
odklizec ,
Thanks for your extra info. That's good info.
Betty
Thanks for your extra info. That's good info.
Betty