Variable binding overwriting repository

Bug reports.
tallahassee101
Posts: 169
Joined: Thu Jan 13, 2011 2:06 pm

Variable binding overwriting repository

Post by tallahassee101 » Wed Jul 04, 2012 3:05 pm

Hi,

In the variables window there are 3 colors to denote the variable's state: Black - In Use, Green - In use from Repo, Yellowish Brown - Not in Use. We are experiencing an issue where we want to use a variable from our Repo within the recording ( called "TrackNumber" ), however when we use it as part of a Key Sequence or in the Validation column for an AttributeEqual-AccessibleValue parameter the variable's color in the Variables Window changes from Green to Black. Once it shows up as Black the test no longer works because it overwrites the repo value. The only way we've found to revert this problem is to convert any code that uses the argument to user code and specify explicitly the repo version of the variable i.e. "repoName.TrackNumber".
This is a defect, as it is new in Ranorex 3.3, we have several recordings that used to work in 3.2 that now do not read the repo value correctly. It seems as if there are two options for the variable's use within the recording the user should have a choice. A right click or a pull down would be nice to allow us to select "Use from Repo".

As a side note passing the variable as an argument for user code seems to work as expected. The variable remains Green in the variables window when used only as an argument.

Thanks,
-Nick

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

Re: Variable binding overwriting repository

Post by Support Team » Thu Jul 05, 2012 3:46 pm

Hello Nick,

Thank you for the report.
When a repository variable is used in a recording module it will be set with the standard value you set in the module variable browser for this repository variable. This behavior is implemented by design in Ranorex and is the same as in version 3.2.
We will treat your post as feature request and we will discuss this issue.
If I didn't understand you correctly please send us a project with the issue.

Regards,
Bernhard
Ranorex Support Team
.
Image

tallahassee101
Posts: 169
Joined: Thu Jan 13, 2011 2:06 pm

Re: Variable binding overwriting repository

Post by tallahassee101 » Thu Jul 05, 2012 4:15 pm

Bernhard,

You must have misunderstood. The problem is that no value is binded to the variable in the test suite and no default value is set in the Variables Browser. The variable 'tracknumber' is still Black denoting it will not use the Repository Variable which I want it to, instead it generates a recording variable named 'tracknumber'.

Thanks,
-Nick

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

Re: Variable binding overwriting repository

Post by Support Team » Fri Jul 06, 2012 5:41 pm

Hi Nick,

I do the following:
I set a variable named 'tracknumber' in the repository
then i use 'Copy variable from Reopsitory'
the variable 'tracknumber will be inserted into the recording with the same default parameter as in the repository.
When i delete the value the following code will be generated in the recording.
public Recording1()
{
  tracknumber = "";
}
So the value of the repository variable will also be set to the blank value.
public string tracknumber
{
    get { return repo.tracknumber; }
    set { repo.tracknumber = value; }
}
Regards,
Bernhard
Ranorex Support Team
.
Image

tallahassee101
Posts: 169
Joined: Thu Jan 13, 2011 2:06 pm

Re: Variable binding overwriting repository

Post by tallahassee101 » Mon Jul 09, 2012 2:24 pm

Bernhard,

That is the behavior I am seeing that I do not want but Ranorex is doing automatically. I do not use "Copy variable from Repository" however, but the generated recording code is doing: tracknumber = ""; which overwrites my repository variable for the current recording. I want it to use the repository variable, not create a new one for the current recording.

Thanks,
-Nick

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

Re: Variable binding overwriting repository

Post by Support Team » Tue Jul 10, 2012 3:10 pm

Hi Nick,

Do you mean that you want to use the value which was set by the previous executed recording, or do you want to use the default value of the repo variable?

Regards,
Markus
Ranorex Support Team
.
Image

tallahassee101
Posts: 169
Joined: Thu Jan 13, 2011 2:06 pm

Re: Variable binding overwriting repository

Post by tallahassee101 » Tue Jul 10, 2012 5:47 pm

Markus,

I want the recording to ALWAYS use the repo item. If I bind the variable in the test suite, set a default value in the recording, or do anything else with the variable inside the recording I want it to be with the variable from the Repository. The problem I am seeing is that there are cases when the recording decides not to use the repository variable 'tracknumber' and it creates a new variable with the identical name that it sets to "" upon initialization.
I want a way to specify to always use the repo variable 'tracknumber' and never set it to "" inside the generated cs file.

Thanks,
-Nick

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

Re: Variable binding overwriting repository

Post by Support Team » Wed Jul 11, 2012 3:34 pm

Nick,
I want a way to specify to always use the repo variable 'tracknumber' and never set it to "" inside the generated cs file.
Just to clarify this, the repo item will just be set to "" when you didn't define a default value for it, if you defined one this value will also be used for the "new" recording variable when you used "Copy Variable from Repository".
Are you working with the new Ranorex Version 3.3.1?
The problem I am seeing is that there are cases when the recording decides not to use the repository variable 'tracknumber' and it creates a new variable
You can't use the repo variable in the recordings actions table without "copying" it, you just can directly use it in User Code.
Did you set it to a value via User Code?
The only thing I can imagine of is that you have created a variable in a recording file which has the same name as one of your repo variables and this new variable sets the repo variable automatically to "", did you mean this?

Regards,
Markus
Ranorex Support Team
.
Image

tallahassee101
Posts: 169
Joined: Thu Jan 13, 2011 2:06 pm

Re: Variable binding overwriting repository

Post by tallahassee101 » Thu Jul 12, 2012 3:55 pm

I have three recordings that use the 'tracknumber' variable as follows:
CreateTrack
ValidateTrack
DropTrack

CreateTrack creates the track and then sets the 'tracknumber' variable. In ValidateTrack and DropTrack recordings the 'tracknumber' variable is not set, nor is there a default value for it. These two tests use the repo variable value that was set in CreateTrack.

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

Re: Variable binding overwriting repository

Post by Support Team » Fri Jul 13, 2012 3:16 pm

Hi Nik,

The repo variable will be set to "" or to the default value when you explicit copy the variable from the repository and this is by design.
In your case I would use a global parameter and bind it to the module variables from the recording files.

Regards,
Markus
Ranorex Support Team
.
Image