Forum Discussion
Thanks for the update.
So in code (i have spent all of 30 minutes playing with namemapping) I have references to Alias.MainForm.Grid.Button1. so if Grid, gets changes to something else, say "class1", when I make the change in the namemapping file, then all references in code will autoupdate?
Also, are there perceived performance benefits to changing to namemapping? This is a project that has been around for going on 5 years, and would be alot of work to make the change (though i am tempted to propose a change to using javascript instead of jscript)
Thanks.
So long as all you do is change the mapping criteria and not the actual name of the alias, then yes, everything should work... it's not a matter of it updating the "code"... just that if your code is referencing Aliases.MainForm.Grid, that will point to whatever you have Grid mapped to, no matter how often you change it. Now, if you change the name from Aliases.MainForm.Grid to Aliases.MainForm.Grid2... then we have a bit of a problem. Keyword tests will automatically update, but script code will not.
I don't know about performance but, honestly, you'll be writing a LOT less code. instead of this:
function test1() { var myButton =Sys.Process('myApp').WinFormsObject('MainForm').WinFormsObject('Grid1').WinFormsObject('Button1'); myButton.Click(); }
All you need is
function test1 () { var myButton = Aliases.MainForm.Grid1.Button1; myButton.Click(); }
Much more readable, really. And you don't have to worry as much about when components change classes, hierarchy, etc... you can "fix" that but just playing with your NameMapping configuration and, if you do it right, you won't need to make any code changes.