Page 1 of 1

Variable value not updating when running test

Posted: Wed Aug 15, 2012 1:26 pm
by Stu B
In a recording I have added a variable:
Name Value
Var#1 Form Title One

I use this in an objects path to validate that a form title bar is displaying the correct text:
Object Path
Titlebar titlebar[@accessiblerole='TitleBar' and @text=$Var#1]

Now I have updated my application form title to Form Title Two so I change Var#1:
Name Value
Var#1 Form Title Two

When I select highlight to find the object it fails, the value it is looking for is still:
titlebar[@accessiblerole='TitleBar' and @text='Form Title One']

I can verify the path contains the correct variable - if i edit the variable Var#1 and change it to Var#2 then the value in the object path is automatically updated to titlebar[@accessiblerole='TitleBar' and @text=$Var#2]

but it still keeps searching for "Form Title One" instead of the variables new value which is "Form Title Two"
(when it is searching for the object I look at the tooltip on the searching for elements popup)

Can you point out what I am doing wrong to update the variable value please?

thanks

Re: Variable value not updating when running test

Posted: Wed Aug 15, 2012 1:42 pm
by krstcs
Stu,

I would recommend not using symbols ("#") in your variable names as this may be interpreted incorrectly by the compiler and could cause your assignments to fail.

Try changing the variable name to something without a symbol (i.e. "Var1") and see if that helps.

Also, variable names should be descriptive of what they are holding. In your case a better name might be "titleBarText", for example. :D

Finally, "Var" is a key word in .NET and should not be used for naming variables.

Hope that helps a bit.

Re: Variable value not updating when running test

Posted: Wed Aug 15, 2012 2:11 pm
by Stu B
Hi krstcs,

thanks for having a look at that and replying.

I should have stated that the variable names and values I have shown are just examples and my actual names & values do reflect the object.

a better example would read:

Original application form title and variable:
VariableName Value
Version FormTitleOne

change form title in application and update variable:
VariableName Value
Version FormTitleTwo

Object path is:
[@accessiblerole='TitleBar' and @text=$Version]

Highlight object:
object not found - search string is:
titlebar[@accessiblerole='TitleBar' and @text='FormTitleOne']

regards

Stu