Forum Discussion
Why do you not want to use NameMapping? This is the primary and preferred/best practice method for object identification in TestComplete. It abstracts the UI object identification from your code so that you can alter your object identification without needing to affect your code (that's the beauty of Aliases). You are using TestComplete, not UFT... So, you may need to adapt your automation techniques to the tool.
TestComplete does not allow you to over-ride/overload/replace the "Click" methods with your own... you still need to work with TestComplete's "Click".
If you WANT to construct your own object identification layer in code, you will want to use liberally the FindChild, FindAllChildren, FindChildEx, etc., methods... but they require you to start with The basics of the AUT... Sys.Process('myapp') or Sys.Browser(<browsername>)... but you're going to lose performance... Finding objects and using any code techniques to construct and recognize objects in code is going to SEVERELY slow your test cases because you will need to search for the object EVERY time... while NameMapping caches much of the information and is internal code logic of the Tool rather than "interpreted" script code... it natively runs faster.
So.... back to question 1: Why do you want to avoid using NameMapping when, for the tool you have selected to use, it is the best practice for the tool?
Thanks Robert for your reply.
In the NameMapping way of object identification,I can't use descriptive way of accessing the object. I will explain you why I need to have descriptive way of access is that I need to have subroutines which are generic and not tied up with NameMapping.
For Ex: I want to create customized Click Button subroutine,so that I can put some customized code like first checking the object exist or not and then add some reporting code.
In UFT, we used to this way sorry for going back to UFT, where we are aware that that we can access the property using descriptive programming and once we create this, we are not concerned about the object repository or in TestComplete case it is NameMapping.
Sub ClickButton(btName)
If Browser("name:=.*").Page("title:=.*").WebButton("name:"=btName).Exist() Then
Browser("name:=.*").Page("title:=.*").WebButton("name:"=btName).Click
End If
End Sub
In the above code, I need just pass the button name and that's it, this will work on any web page or button, so it is application independent and more useful in organizing subroutines or function.
Regards,
Nimish