Post
by krstcs » Mon Jun 15, 2015 7:08 pm
As a bit of further clarification, variables are objects that hold a value inside a function or method in most languages. So, your variables are the ones that are inside the recording module. Their values may change (hence being variable) during the time that the function or method runs.
Parameters are values that are passed IN to something. In your case, you have command-line parameters that are passed into your testcase parameters. Functions and methods also have parameters, which can be used as variables inside the body of the function/method. This can be confusing, but once you start using them you will understand them better.
Binding is the way of telling Ranorex (or any other data-driven application) what data source goes to what data consumer. Your source is the parameter, your consumer is the recording module, so you have to bind the module's variables to the data source's parameters.
One other thing. It is a good practice to always name your variables and parameters the same thing, if they are going to be used to bind to each other and only each other. Also, name your variables/parameters using something meaningful, not just "var1" or "a". I know in your case you were working on an example, so it's not a big deal, but on a real application (your tests are applications...) you want to make sure that anyone reading the code understands what a variable is for, what it will hold, or what needs to be done with it. For example, use the variable name "UserName" to hold the value of the username that needs to be entered into your system-under-test. Then name the parameter "UserName" as well. One added benefit to doing this is that Ranorex can automatically bind (hint: click Autobind Variables button) variables to parameters with the same name.
Finally, you can bind multiple variables to the same parameter (or data source) if you need to do that. And they can all still use the same names.
Shortcuts usually aren't...