Unbound variable warning

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Unbound variable warning

Post by bsing » Wed Oct 31, 2012 5:23 am

Hi there,

I have a test case that has an "Unbound variable" and is flagged as a warning.

I'm not sure how to remove this unbound variable as the test case has no datasource.

Is there a way of removing this unbound variable?

See attached snapshots.

Brad.
Attachments
NoDataSource.png
NoDataSource.png (17.03 KiB) Viewed 2534 times
UnboundVariable.png
UnboundVariable.png (3.98 KiB) Viewed 2534 times

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

Re: Unbound variable warning

Post by Support Team » Wed Oct 31, 2012 3:32 pm

Hi,

Currently not but I already added this feature request, see the following forum post: Unbound variables.

Regards,
Markus
.
Image

bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Re: Unbound variable warning

Post by bsing » Wed Oct 31, 2012 11:43 pm

thanks Marcus.

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

Re: Unbound variable warning

Post by krstcs » Thu Nov 01, 2012 1:43 pm

Bsing,

You could also add a global parameter to your test suite (like "UNMAPPED_VAR") and bind any unmapped variables to it.

In your test suite,
1. Right click the top-level test suite name.
2. Select "Global Parameters".
3. Add the parameter to the list.
4. Click 'OK'.
5. Right click the desired test or test case.
6. Select "Data Binding".
7. Map the parameter from 3. above to any test variables that you don't want to see warnings for.
8. Click OK.

Hope this helps! :D

bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Re: Unbound variable warning

Post by bsing » Mon Feb 25, 2013 5:09 am

Has this defect been fixed yet? I have download the latest Ranorex (4.0.2) and am still getting warnings in the reports for unbound variables.

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

Re: Unbound variable warning

Post by krstcs » Mon Feb 25, 2013 5:10 pm

I do not believe that what you are referring to is actually a defect, but is instead a design decision. You want that warning so you know if things aren't being mapped when they should be.

My suggestions:

1. If you have a variable that isn't being mapped because it isn't needed, you should remove it from the test module.

2. If you need the variable in the module then you can use the process that I posted originally to map the variable to a global parameter that isn't used. That will avoid the warning.
Shortcuts usually aren't...

bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Re: Unbound variable warning

Post by bsing » Tue Feb 26, 2013 12:17 am

Yes ... you are correct. I wasn't sure how to remove unwanted module variables ... but worked it out.

Thanks :D

Brad.

bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Re: Unbound variable warning

Post by bsing » Tue Feb 26, 2013 12:33 am

On further investigation only the unused module variables are able to be removed.

I still get "Unbound varables" even when they are being used.

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

Re: Unbound variable warning

Post by Support Team » Tue Feb 26, 2013 5:04 pm

Hello,

The message "Unbound variables" will be shown in your test suite if there is at least one variable, which is not bound to a Data Source. There is no difference between a used or an unused variable. As krstcs said this is a design decision.

Regards,
Bernhard
.
Image

User avatar
sandamal
Posts: 28
Joined: Wed Jul 08, 2015 7:50 am

Re: Unbound variable warning

Post by sandamal » Fri Sep 04, 2015 7:12 am

Hi , Im using Ranorex 5.2.2xxx

Can some one tell me the steps to delete a module variable.
couldn't find it :|

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Unbound variable warning

Post by odklizec » Fri Sep 04, 2015 7:19 am

Hi,

You can delete module variables via Edit Variables dialog. But it's possible to delete only "not used" variables! In other words, if you want to delete a module variable, you first need to remove all references of the variable from recording and/or user code. Once done, variable is set as "Not in use" and only then you can delete it.
DeleteVars.png
DeleteVars.png (28.74 KiB) Viewed 1888 times
Pavel Kudrys
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

RX-User007
Posts: 2
Joined: Tue Mar 21, 2017 4:41 pm
Location: Kiev

Re: Unbound variable warning

Post by RX-User007 » Tue Apr 04, 2017 5:00 pm

I have a testcase with a module with 2 variables that worked fine. After adding a second recording module in the same test case with two additional (different) local variables, I notice that each time I bind the two variables in module 2, the ones in the other recording become unbound?! And when I bind the ones in recording 1, the two variables in recording 2 become unbound. Pardon my French, but this is annoying me a lot, help appreciated.

RX-User007
Posts: 2
Joined: Tue Mar 21, 2017 4:41 pm
Location: Kiev

Re: Unbound variable warning

Post by RX-User007 » Tue Apr 04, 2017 5:38 pm

Ok, I got it, one datafile per test case. Hurray for myself? :-)