Can I do a wildcard in an Alias name?
- 7 years ago
To expand on baxatob, yes, you can use wildcards in NameMapping... Say, for example, I have a component, call it textboxFoo12 with an Alias path of Aliases.MyApplication.MyForm.textboxFoo12, that I am mapping it in NameMapping using the ObjectIdentifier and ObjectType properties like so:
ObjectType -> TextBox
ObjectIdentifier -> Foo_1_2
I named it textboxFoo12 because that matched the ObjectIdentifier at the time of my original mapping.
Now, let's say my developers change something so that the identifier changes. It's no longer Foo_1_2, it's now Foo_1_3 because the version has changed. I can go in and edit my NameMapping like so
ObjectType -> TextBox
ObjectIdentifed -> Foo_1_3
The Alias pathing is still Aliases.MyApplication.MyForm.textboxFoo12 but now TestComplete will find the component properly because I adjusted the mapped property values.
But then, if the developers change the application again, I'll just have to keep editing my mapping... real PITA. So, instead, I change my mapping to
ObjectType -> TextBox
ObjectIdentifier -> Foo_*
This allows textboxFoo12 to always be found, regardless of the numerical portion of the properties.
What you CANNOT do, because a) NameMapping doesn't work this way and b) it doesn't make sense to have multiple mappings of the same component, is edit your Aliases to Aliases.MyApplication.MyForm.textboxFoo*. Aliases are a layer on top of the NameMapping identification algorithms. So, your better bet is to wildcard the properties uses for identification.