10-12-2017 08:44 AM
I just started with my Test Environment and already came across a few veryyyy bad problems using these aliases ...
Why should i use this aliases?
When i use the namemapping path it automatically corrects testcases in my project, when this namemapping changes...
On the other hand, if I used the alias it created for the namemapping and these get changed, it doesnt change the aliases used in testcases.
Right now i only have like 10 testcases - but when I have a big project where i use those aliases a couple of thousand times it would be like a destroyed project, just renaming 1 alias ...
In my case was the problem that 1 element (a panel) got added so I remapped the panel and dragged the objects onto this panel -> making the alias change for this instead of xxx.element it was than xxx.panel.element making all my testcases unrunable
10-12-2017 09:16 AM
Ok I just found out, that it actually adapts the keyword tests to changed aliases, but only half of the used objects.
on-screen action elements -> get changed to the new alias
Alias Values in if...then / Set Variable -> dont get changed
Is this a bug / incomplete feature?
10-12-2017 09:36 AM
The purpose of Aliases is to translate what's in the NameMapping tree to something useful.
So, let's say for example, in a web application, you have the following in NameMapping
By default, TestComplete creates the Alias like so
Obviously, this works just fine... but it's an awefully long string. A lot of those "panel" designators are just DIV tags in your web page that you never interact with directly. So, they kind of take up space in your automation and confuse things. So, let's say you want the button to be referenced directly off the page. You DO NOT change the NameMapping tree. Instead, you drag "button" to be a direct child of myPage and delete the other Aliases (make sure, when doing so, when prompted you DO NOT delete the corresponding NameMapping items). What you are left with then is
And you use that throughout your automation.
Now, say your developers change your application where they add new Div tags etc. Technically, you don't need to change the Alias at all. Simply go to the NameMapping and add the additional intervening objects as necessary. Then TestComplete can still find the object and NONE OF YOUR CODE ever needs to change.
THAT'S what Aliases does for you... it provides a translation layer between NameMapping and your code so that you can identify your objects via Alias in your code and re-organize your NameMapping as necessary.
In our environment, as a Best Practice, we NEVER change an Alias if we can avoid it. That way we don't "break" even those "if..then" or "Set Variable" options.
10-13-2017 07:23 AM
As you noted, it's already updating a good chunk of where the Alias is being used in keyword tests. There are few outliers out there but, again, the Best Practice is to avoid altering Aliases once they are in use. There really is no need to for most development work because any adjustments to object identification can be handled through the NameMapping panel which is invisible to any test or code using an Alias.
if there is a specific improvement you want to see, you can submit a feature request for consideration.