Object Mapping concept
I have gone through the "Object mapping" topic. But still I am not clear about the concept. [img]images/icons/frown.gif[/img]
Can anyone explain me the concept in steps, with example in VBscript? And also where we use it and why we use it.
Thanks in advance,
Re: Object Mapping concept
TestComplete recognizes standard Win32 controls by the class names of their windows specified in the "Object Mapping" property of a project. If an object is treated as a standard Win32 control, TestComplete adds specific properties and methods to it (e.g. the "wText" property for an edit box or the "SelectItem" method for a list box). The "Object Mapping" feature allows you to add the window class of some control to the list of window classes matching a standard control. Therefore, you can use standard methods and properties to work with your control.
For example, assume an edit box has the "MyEditBox" window class. To enter some text into this edit box, you need to click it and then call the "Sys.Keys" method:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Call EditBox.Click()
Call Sys.Keys("Some text"</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">If you map this object to the standard Edit box, you can the "wText" property that is common for all edit boxes:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">EditBox.wText = "Some text"</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">To map an object, you need to perform the following steps:
1. Right-click the project in the Project Explorer panel;
2. Select the "Edit | Properties" item from the context menu;
3. Select the "Object Mapping" item in the left side of the Properties panel;
4. Find the "Edit box" item in the list of available controls and select it;
5. Click the "Add class name" button to add the "MyEditBox" class name in the list that TestComplete uses for the recognition of standard edit boxes.
However, please note that if your custom control does not respond to Windows messages in the same manner as a standard control does, the common methods and properties may not work for it.
Save on AutomatedQA Products