Repo Variable Displays As Unbound

Ask general questions here.
costamesakid
Posts: 94
Joined: Tue Jun 16, 2009 10:27 pm

Repo Variable Displays As Unbound

Post by costamesakid » Fri May 02, 2014 10:59 pm

I created a 'Common' library where I can store functions I routinely use. In the image below be advised that only the 'Locate_User' function uses a repo item which has a variable in its path ($user).
ScreenHunter_18 May. 02 14.58.jpg
ScreenHunter_18 May. 02 14.58.jpg (99.91 KiB) Viewed 706 times
I also have a recording 'CreateOffenses' that inherits the functions from the library.
ScreenHunter_19 May. 02 14.59.jpg
ScreenHunter_19 May. 02 14.59.jpg (17.62 KiB) Viewed 706 times
In the recording I reference the 'Enter_Current_Date' function. This function contains no repo items with variables.
ScreenHunter_20 May. 02 15.00.jpg
ScreenHunter_20 May. 02 15.00.jpg (6.66 KiB) Viewed 706 times
When I build the solution I continually get a warning on this recording saying the variable $user is not bound to a data column. Why is this warning occurring when I am referencing a function that contains repo items without variables? If I was referencing the 'Locate_User' function I could understand this warning but I am not.

Thanks for the help

mrollins
Posts: 10
Joined: Wed Aug 28, 2013 6:35 pm

Re: Repo Variable Displays As Unbound

Post by mrollins » Mon May 05, 2014 4:17 pm

I have also run into this problem and was about to post a similar question.

In addition to this issue, is there any way to hide the unbound variable warning when I manually assign a value to a repo variable in code? (e.g. repo.Variable = variable;) I would like to make my code self contained if it can find the value for itself. I can hide the warning, but that does nothing for the 70+ unbound variable notes in the rxtst file when I view it that can hide actual missing binds that aren't intentional.
Michael Rollins

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Repo Variable Displays As Unbound

Post by krstcs » Mon May 05, 2014 4:42 pm

You can turn off the warnings in the Ranorex options, but I would not recommend it. Warnings are there to warn you about things that are important.

Also note that assigning a value to a variable is different than binding it to a data source.

I would suggest that you create a global parameter (or multiple) that would be your binding for any variable that you don't want to actually bind to another data source. You could call it "NO_BIND", for example, so everyone knows what it is used for. Then, just go through your tests and bind any variables that you don't want to see warnings for to that parameter.

This is the easiest (and in my opinion best) way to not have the warnings.


On a more base note though, the fact that there are variables for which bindings are not being created should probably be taken as a bad thing given the way Ranorex is designed. It can be done, but it probably shouldn't be. I would ask why those variables are being created, and if there might be a better way to structure the tests so that they are not needed. If the test just needs to pass a few variables around (such as row indexes or PIDs, etc.), no problem, that's what the parameters are for. But if variables are being created to hold test data, then they probably should be bound to a data source.

But that's just my opinion from my experience. Take it for what it's worth to you... :D
Shortcuts usually aren't...

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Repo Variable Displays As Unbound

Post by mzperix » Tue May 06, 2014 10:45 am

Hi costamesakid,

I agree with krstcs, you should rethink in the first place if those unbound variables can be replaced with a data source.

If you are using dinamically created data, then you could use a .csv or simple data data container, since it is easy to manipulate those data from code, and the data can be accessed after the run also.


Best REgards,
Zoltan