Data range value as a parameter

Ranorex Spy, Recorder, and Studio.
senouci
Posts: 1
Joined: Tue Aug 02, 2016 11:03 am

Data range value as a parameter

Post by senouci » Tue Aug 02, 2016 11:45 am

Hi,

According to Data Driven Architecture approach, I would like to know if it's possible to get a data range value dynamically from a module variable or global parameter or column of a database table ?

As tangible benefit of using a dynamic data range value, testing projects using a database, linking between Primary and Foreign keys of entities of database schema become easy :idea:
Thanks in advance for your replay

Hicham SENOUCI

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Data range value as a parameter

Post by asdf » Mon Aug 08, 2016 11:20 am

Hi Senouci,

I'm not exactly sure what you want to achieve, but if I understand this correctly, the code below could help you.
Just create a code module and place it in the setup of your testsuite.

Code: Select all

int min_range = Convert.ToInt32(DataRange.Split(',')[0])-1;
int max_range = Convert.ToInt32(DataRange.Split(',')[1])-1;			
Ranorex.Core.Testing.TestSuite.Current.GetTestCase("TestCase").DataContext.SetRange(min_range,max_range);
Ranorex.Core.Testing.TestSuite.Current.GetTestCase("TestCase").DataContext.ReloadData();
You will have to make a variable called "DataRange" and bind it to a global parameter. The parameter should contain the data range, separated through a comma. (e.g. 1,5)

Hope this helps.

Kind regards,
asdf