Warning message "Variables not bound"

Ranorex Studio, Spy, Recorder, and Driver.
HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Warning message "Variables not bound"

Post by HansSchl » Thu Jan 02, 2020 4:11 pm

Hi,

Ranorex warns me "The following module variables in module '...' are not bound to a data column: ...". I googled for the reason and found it related to data-driven testing, which isn't what I am doing here. In fact these variables are filled at run time with values that are calculated by user code. (I believe this is called "validation variable" in Ranorex speak.) All variables are defined in the "Edit variables" dialog and have proper default values.

What else do I have to do to do away with this warning?

Edit: Ranorex version 9.2.0.

Thanks
Hans

foals11
Posts: 20
Joined: Wed Sep 18, 2019 9:19 am

Re: Warning message "Variables not bound"

Post by foals11 » Fri Jan 03, 2020 10:26 am

Hi,

These warnings appear when you use module variables, but don't bind them to a data connector or parameter (data-driven testing).
If your test gets executed as expected, you don't have to worry about these warnings.

regards,

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: Warning message "Variables not bound"

Post by HansSchl » Fri Jan 03, 2020 12:57 pm

you don't have to worry about these warnings.
Out of habit, I always worry about warnings. The code I write has zero warnings before I submit it for production. :) By removing warnings from test cases I prevent the test department from repeatedly asking me about the warning :lol:
Ok, then, how can I change the "module variable" into something else that doesn't produce a warning?

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Warning message "Variables not bound"

Post by McTurtle » Fri Jan 03, 2020 1:24 pm

Hi Hans,

You can disable the warning for each test case in the properties of the test case:
TestCaseproperties.png
Does this help?

Regards,
McTurtle
You do not have the required permissions to view the files attached to this post.

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: Warning message "Variables not bound"

Post by HansSchl » Fri Jan 03, 2020 5:12 pm

Yes, this might help, but I don't know how to open this "properties" dialog. I tried this: Right-click the test case in the "Projects" window, then click "Properties" from the menu. That opens test case properties that do not even remotely resemble your screen shot.
2020-01-03_17h07_08.png
Or: open "Properties" from the View menu but that doesn't contain this option either.
2020-01-03_17h08_14.png
I must be missing something crucial...

Thanks anyway
Hans
You do not have the required permissions to view the files attached to this post.

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

Re: Warning message "Variables not bound"

Post by odklizec » Fri Jan 03, 2020 6:49 pm

Hi,

What you have right-clicked is “Project” node. But you must go to “Test Suite” view and here right-click every single Test Case Container and its Properties uncheck the option suggested by McTurtle. There is unfortunately no global option for this warning.
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

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: Warning message "Variables not bound"

Post by HansSchl » Tue Jan 07, 2020 9:15 am

Hi odklizec,

thank you for your reply. This actually did the trick. No warnings anymore :-)
Happy new year!

Hans

ThoFi
Posts: 5
Joined: Mon Feb 07, 2022 5:32 pm

Re: Warning message "Variables not bound"

Post by ThoFi » Mon Feb 07, 2022 5:37 pm

I am using Ranorex 10.1.6 and I can only disable the warning for the whole test suite, not for single test cases which is a very broad stroke.

Is there a way to disable the warning for single test cases only?
Or can I tell Ranorex that I don´t want to bind the variable to any data source since it´s generated by my user code?

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: Warning message "Variables not bound"

Post by HansSchl » Tue Feb 08, 2022 8:27 am

Hello ThoFi,
I am using Ranorex 10.1.6 and I can only disable the warning for the whole test suite, not for single test cases which is a very broad stroke.
I can't say for 10.1.6 but in 10.1.3, I can set this flag for each container (test suite, test case, smart folder) individually. First of all, you must open the "Properties" tab. I managed to do that by right-clicking a file in the "Projects" tree and then selecting "Properties" from the pop-up menu. I guess there is a more intuitive way but I didn't find it. When now you click a container in the test (the open rxtst file), the "Properties" contains the "Warn for unbound variables" option.

As a general note, I found it much better to bind all variables so it is much harder for binding errors to pass unnoticed. It nevertheless happens...

ThoFi
Posts: 5
Joined: Mon Feb 07, 2022 5:32 pm

Re: Warning message "Variables not bound"

Post by ThoFi » Tue Feb 08, 2022 9:51 am

Thank You, it worked. I must have been blind. :)
ThoFi wrote:
Mon Feb 07, 2022 5:37 pm
As a general note, I found it much better to bind all variables so it is much harder for binding errors to pass unnoticed. It nevertheless happens...
I totally agree, but how can this be done correctly in my case?
I am passing a string to a user code action that transforms the string and returns it. This returned string is then used as a new variable within the module.
Is there a way to bind this variable?

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: Warning message "Variables not bound"

Post by HansSchl » Tue Feb 08, 2022 10:16 am

I bind this type of variables to parameters in the test case or one of its smart folders. As a convention, I start the parameter name with an underscore to indicate that it receives its value from an action such as a user code call. This also allows to reuse the returned value later. For example, I query the number of files in a directory via user code when the test starts, and can use this value for verification when the test ends.
Are you aware that you can bind variables not only to fields from a data source, but also to parameters defined on various levels?

Hans

ThoFi
Posts: 5
Joined: Mon Feb 07, 2022 5:32 pm

Re: Warning message "Variables not bound"

Post by ThoFi » Tue Feb 08, 2022 10:24 am

Thank You very much!
This is the advise I was looking for.

Using variables is a topic I still need to dive into a bit. :)