How to find out if a data range is active or not?

Class library usage, coding and language questions.
wf1
Posts: 7
Joined: Thu Jun 21, 2012 10:03 am

How to find out if a data range is active or not?

Post by wf1 » Mon Apr 08, 2013 4:51 pm

Hi,

within a code module I want to find out if I am currently in the first / last iteration of a test case.
As long as there is no data range defined within the attached data connector this is no problem. In this case I can get the current row index with

Code: Select all

TestCase.Current.DataContext.CurrentRowIndex
and then check if it is the first / last row index.

But if there is a data range defined within the attached data connector then I must know if the data range is active and if so then I must check if the current row index is the first / last index within the data range. But I could not find any possiblity how to decide if the data range is currently active or not. If the data range is active then the XML attribute datarangeactive="True" will be written to the .rxtst file but there no corresponding property which provides this value. The DataRange class only has the properties MaxRange and MinRange but I miss a property like IsActive.

Of course I could read the .rxtst file and parse it for the attribute datarangeactive="True". But is there no easier way to find out if a data range is active?

Any help would be appreciated.

Regards
wf1

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to find out if a data range is active or not?

Post by Support Team » Wed Apr 10, 2013 12:36 pm

Hi,

Why do you want to check if it is the first/last index? Maybe this can be handled in another easier way.
Could you therefore describe the use case?

Thanks,
Markus
.
Image

wf1
Posts: 7
Joined: Thu Jun 21, 2012 10:03 am

Re: How to find out if a data range is active or not?

Post by wf1 » Thu Apr 11, 2013 1:11 pm

Hi Markus,

the use case is as follows:
- I have a test step which does some initialization stuff. This test step shall be executed only once in the first iteration of the test case,
- and I have a test step which does some cleanup stuff. This test step shall be executed only once in the last iteration of the test case.

That's why I want to find out within the corresponding code modules if I am currently in the first / last iteration of the test case.

Regards
wf1

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: How to find out if a data range is active or not?

Post by swmatisa » Thu Apr 11, 2013 4:03 pm

Hello, I think you must use "setup" and "teardown":
http://www.ranorex.com/support/user-gui ... suite.html
SW

wf1
Posts: 7
Joined: Thu Jun 21, 2012 10:03 am

Re: How to find out if a data range is active or not?

Post by wf1 » Fri Apr 12, 2013 2:20 pm

Hello,
setup / teardown does not help because the modules within the setup / teardown regions are being executed for each iteration of the test case.

Regards
wf1

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: How to find out if a data range is active or not?

Post by swmatisa » Mon Apr 15, 2013 11:55 am

Hello,

You can nest the test case:
Attachments
OneSetup.png
OneSetup.png (22.91 KiB) Viewed 1868 times
SW