Depending on the development tool, various applications use various classes to implement the same control. For instance, Microsoft Visual C++ implements tree view controls via the CTreeView
class while Borland Delphi and C++Builder use the TTreeView
class.
During test recording, TestComplete detects the class name of controls and uses it to find a suitable test object. Then it uses the properties and methods of the test object to represent user actions performed on the control. Linking a control’s class name to a test object is called object mapping.
Let’s see how it works. Suppose, in our test we interact with Windows Explorer. It uses a tree view control to show a tree of folders. Without object mapping, TestComplete will record only mouse clicks within the Explorer window:
JavaScript, JScript
p = Sys.Process("explorer");
w = p.Window("ExploreWClass", "My Computer");
// TestComplete notes the mouse click
w.Window("SysTreeView32").Click(49, 23);
Python
p = Sys.Process("explorer")
w = p.Window("ExploreWClass", "My Computer")
# TestComplete notes the mouse click
w.Window("SysTreeView32").Click(49, 23)
VBScript
Set p = Sys.Process("explorer")
Set w = p.Window("ExploreWClass", "My Computer")
' TestComplete notes the mouse click
Call w.Window("SysTreeView32").Click(49, 23)
DelphiScript
p := Sys.Process('explorer');
w := p.Window('ExploreWClass', 'My Computer');
// TestComplete notes the mouse click
w.Window('SysTreeView32').Click(49, 23);
C++Script, C#Script
p = Sys["Process"]("explorer");
w = p["Window"]("ExploreWClass", "My Computer");
// TestComplete notes the mouse click
w["Window"]("SysTreeView32")["Click"](49, 23);
If we map the tree view control’s class (SysTreeView32
) to the Win32TreeView
object, TestComplete will record user actions on the tree view as calls to the Win32TreeView
object’s methods:
JavaScript, JScript
p = Sys.Process("explorer");
w = p.Window("ExploreWClass", "My Computer");
// TestComplete notes the high-level call
w.Window("SysTreeView32").ClickItem("|Desktop|My Computer");
Python
p = Sys.Process("explorer")
w = p.Window("ExploreWClass", "My Computer")
# TestComplete notes the high-level call
w.Window("SysTreeView32").ClickItem("|Desktop|My Computer")
VBScript
Set p = Sys.Process("explorer")
Set w = p.Window("ExploreWClass", "MyComputer")
' TestComplete notes the high-level call
Call w.Window("SysTreeView32").ClickItem("|Desktop|My Computer")
DelphiScript
p := Sys.Process('explorer');
w := p.Window('ExploreWClass', 'My Computer');
// TestComplete notes the high-level call
w.Window('SysTreeView32').ClickItem('|Desktop|My Computer');
C++Script, C#Script
p = Sys["Process"]("explorer");
w = p["Window"]("ExploreWClass", "My Computer");
// TestComplete notes the high-level call
w["Window"]("SysTreeView32")["ClickItem"]("|Desktop|My Computer");
This way, using object mapping makes your tests more robust and readable.
Each project in TestComplete has Object Mapping settings that specify controls TestComplete can recognize. For each control type, it provides a list of classes associated with this type. For instance, the Win32 TreeView
type is associated with *TreeView*
classes; that is, all Win32 controls whose class name includes the TreeView string are associated with the TreeView
object.
All types of controls supported by TestComplete are organized into the following categories:
Android Controls
Android ControlsAndroid ControlsThis category holds Android controls for which TestComplete provides extended support. Currently, the Android Controls category holds the following control types:
To identify Android controls, TestComplete uses their class name which is specified by the JavaFullClassName
property.
Borland Controls
Borland ControlsBorland ControlsThis category holds Borland and CodeGear controls for which TestComplete provides extended support. Currently, the Borland Controls category holds the following control types:
- DBGrid. This item contains a DBGridInplaceEdit child item that lets you map custom elements of a DBGrid control to base ones.
- StringGrid
TestComplete identifies these controls by their class name, which is specified by the ClassName
property.
Developer Express Controls
Developer Express ControlsDeveloper Express ControlsThis category holds Developer Express controls for which TestComplete provides extended support. Currently, the Developer Express Controls category holds the following control types:
- VCL:
- BarDockControl. This item contains a number of child items that let you map custom elements of a BarDockControl control to base ones.
- Button
- CheckBox
- CheckListBox. This item contains a CustomInnerCheckListBox child item that lets you map custom elements of a CheckListBox control to base ones.
- ColorComboBox. This item contains a ColorComboBoxListBox child item that lets you map custom elements of a ColorComboBox control to base ones.
- ComboBox. This item contains a ComboBoxListBox child item that lets you map custom elements of a ComboBox control to base ones.
- ExpressNavBar
- ExpressVerticalGrid
- ImageComboBox. This item contains an ImageComboBoxListBox child item that lets you map custom elements of a NumericStepper control to base ones.
- QuantumGrid. This item contains a number of child items that let you map custom elements of a QuantumGrid control to base ones.
- QuantumTreeList
- RadioButton
- RadioGroup. This item contains a RadioGroupButton child item that lets you map custom elements of a RadioGroup control to base ones.
- Ribbon
- SpinButton
- TrackBar
- WinForms:
- WPF:
- BarManager. This item contains a number of child items that let you map custom elements of a BarManager control to base ones.
- GridControl. This item contains a number of child items that let you map custom elements of a GridControl control to base ones.
TestComplete identifies Developer Express controls by their class name.
The class names of .NET controls are specified by their ClrFullClassName
property, the class name of VCL controls - by the ClassName
property.
Flex Controls
Flex ControlsFlex ControlsThis category holds Adobe Flex controls for which TestComplete provides extended support. Currently, the Adobe Controls category holds the following control types:
- Button
- DataGrid. This item contains a number of child items that let you map custom elements of a grid control to base ones.
- DateChooser. This item contains the CalendarLayout child item that lets you map custom elements of a DateChooser control to base ones.
- DateField. This item contains a TextInput child item that lets you map custom elements of a DateField control to base ones.
- LinkBar. This item contains a LinkButton child item that lets you map custom elements of a LinkBar control to base ones.
- MxScrollBar. This item contains a Scroll Thumb child item that lets you map custom elements of a MxScrollBar control to base ones.
- NumericStepper. This item contains a TextInput child item that lets you map custom elements of a NumericStepper control to base ones.
- PopupButton
- Scroller
- Slider. This item contains a Slider Thumb child item that lets you map custom elements of a Slider control to base ones.
- Spark DataGrid
- Spinner. This item contains a Group child item that lets you map custom elements of a Spinner control to base ones.
- TreeView. This item contains ItemRenderer and TreeNodeImage child items that let you map custom elements of a TreeView control to base ones.
To identify Adobe Flex controls, TestComplete uses their fully qualified class name.
Infragistics Controls
Infragistics ControlsInfragistics ControlsThis category holds Infragistics controls for which TestComplete provides extended support. Currently, the Infragistics Controls category holds the following control types:
To identify Infragistics controls, TestComplete uses their full class name, which is specified by the ClrFullClassName
property.
iOS Controls
iOS ControlsiOS ControlsThis category holds iOS controls for which TestComplete provides extended support. Currently, the iOS Controls category holds the following control types:
To identify iOS controls, TestComplete uses their class name which is specified by the
ObjectClassName
property.
JavaFX Controls
JavaFX ControlsJavaFX ControlsThis category holds JavaFX controls for which TestComplete provides extended support. Currently, the JavaFX Controls category holds the following control types:
To identify JavaFX controls, TestComplete uses their full class name, which is specified by the JavaFullClassName
property.
Microsoft Controls
Microsoft ControlsMicrosoft ControlsThis category holds Microsoft controls for which TestComplete provides extended support. Currently, the Microsoft Controls category holds the following control types:
- MFC:
- Silverlight:
- WinForms:
- WPF:
- WPFRibbon. This item has a number of child items that let you map custom elements of a ribbon control to base ones.
- WPFToolkitCalendar. This item has a CalendarDayButton child item that lets you map custom elements of a WPFToolkitCalendar control to base ones.
- WPFToolkitDataGrid. This item has a number of child items that let you map custom elements of a WPFToolkitDataGrid control to base ones.
- WPFToolkitDatePicker
To identify Microsoft controls, TestComplete uses their class names. The full class name of a .NET control is specified by the ClrFullClassName
property, the class name of an MFC control is specified by the ClassName
property.
Oracle Forms Controls
Oracle Forms ControlsOracle Forms ControlsThis category holds Oracle Forms controls for which TestComplete provides extended support. Currently, the Oracle Forms Controls category holds the following control types:
To identify Oracle Forms controls, TestComplete uses their full class name, which is specified by the JavaFullClassName
property.
Qt Controls
Qt ControlsQt ControlsThis category holds Qt controls for which TestComplete provides extended support. Currently, the Qt Controls category holds the following control types:
To identify Qt controls, TestComplete uses their full class name, which is specified by the QtClassName
property.
Rogue Wave Controls
Rogue Wave ControlsRogue Wave ControlsThis category holds Rogue Wave controls for which TestComplete provides extended support. Currently, the Rogue Wave Controls category includes the following control types:
To identify Rogue Wave controls, TestComplete uses their full class name.
Swing Controls
Swing ControlsSwing ControlsThis category holds Java Swing controls for which TestComplete provides extended support. Currently, the Swing Controls category holds the following control types:
To identify Java Swing controls, TestComplete uses their full class name, which is specified by the JavaFullClassName
property.
Syncfusion Controls
Syncfusion ControlsSyncfusion ControlsThis category holds Syncfusion controls for which TestComplete provides extended support. Currently, the Syncfusion Controls category holds the following control types:
To identify Syncfusion controls, TestComplete uses their full class name, which is specified by the ClrFullClassName
property.
Telerik Controls
Telerik ControlsTelerik Controls
TMS Software
TMS SoftwareTMS SoftwareThis category holds TMS Software controls for which TestComplete provides extended support. Currently, the TMS Software category holds the following control types:
To identify TMS Software controls, TestComplete uses their class name, which is specified by the ClassName
property.
Win32 Controls and Windows
Win32 Controls and WindowsWin32 Controls and WindowsThis category holds Win32 controls for which TestComplete provides extended support. TestComplete identifies these controls by their class name specified by the WndClass
property. Currently, the Win32 Controls and Windows category holds the following control types:
WPF Controls
WPF ControlsWPF ControlsThis category holds WPF (XAML) controls for which TestComplete provides extended support. Currently, the WPF Controls category holds the following control types:
To identify WPF (XAML) controls, TestComplete uses their full class name, which is specified by the ClrFullClassName
property.
Xamarin.Forms Controls
Xamarin.Forms ControlsXamarin.Forms ControlsThis category holds Xamarin.Forms controls for which TestComplete provides extended support. Currently, the Xamarin.Forms Controls category holds the following control types:
To identify Xamarin.Forms controls, TestComplete uses their full class name, which is returned by the ClrFullClassName
property.
Xceed Controls
Xceed ControlsXceed ControlsThis category holds Xceed controls for which TestComplete provides extended support. Currently, the Xceed Controls category holds one control type:
- DotNetGrid. This item contains a number of child items that let you map custom elements of a grid control to base ones.
To identify Xceed controls, TestComplete uses their full class name, which is specified by the ClrFullClassName
property.
Besides the mentioned categories and control types, the Object Mapping settings can include categories and items provided by custom control support plugins.
|
Each type is supposed to hold class names of the corresponding standard control and/or its descendants. Mapping a control to an improper type (for instance, mapping a tree view control to a Toolbar type) will cause errors during recording and simulating actions over controls in general. |
To learn whether TestComplete recognizes your custom control as a supported control, analyze your custom control’s class name. If the custom control’s class name matches any of the supported classes, TestComplete will recognize your control as the appropriate control type and will provide extended properties and methods to simulate user actions on it. To learn the class name of your custom control, locate your control in the Object Browser and check one of the following properties (depending on your control type): WndClass
, ClassName
, ClrFullClassName
, JavaFullClassName
or QtClassName
. You can also learn the control’s class name from the tested application’s developers.
You associate a control’s class name with a supported type or remove an association on the Properties > Object Mapping page of your project. You can also modify mapping associations in the Object Mapping section of the Default Project Properties dialog. In this case, TestComplete will apply the specified mapping settings to each new project you create.
To map a control class name
-
Select the type to which you want to map the control.
-
Click Add Class Name and enter the control’s class name.
– or –
-
Make sure that the application containing your custom control is running and the control is visible on screen.
-
On the Properties > Object Mapping page of your project, select the type to which you want to map the control.
-
Click Add From Screen. This will call the Add New Object Class dialog.
-
Select the desired control and click OK. TestComplete will add the control’s class name to the list.
-
If an item is selected in the class names list before you call the dialog, TestComplete will ask whether you want to replace the selected item or add a new item to the list. To replace the selected class name, click Yes. Click No to leave the selected item unchanged and add the captured class name to the list.
Class names are case-insensitive. In addition, you can use the asterisk (*) and question mark (?) wildcards in class names. The asterisk corresponds to the string of any length, the question mark—to any single character. Use wildcards to create class name templates that associate a group of similar class names with a specific type. For example, the *TreeView* template matches all class names that include the TreeView substring.
|
TestComplete interacts with controls of a specific type via the interface that is supported by standard controls of this type. So, if a custom control does not support the required interface or implements it improperly (which can take place if it is neither a standard control nor its descendant), Object Mapping will not be helpful. That is, TestComplete will extend the control with supplementary properties and methods, but they will not work. |
To modify an associated class name
-
Click the desired class name in the list.
-
Enter a new class name in the in-place editor. Press Enter to confirm the changes or Esc to cancel them.
To map the descendants of the associated class
To associate a control type with a class and its descendant classes, select the Derived Classes check box next to the control’s class name.
To disable a class name association
Clear the Enabled check box.
To remove a class name association
-
Select the desired class name in the list.
-
Click Remove Class Name or Del.
However, we recommend that you disable class name associations rather than remove them. Removing a predefined association will affect the way TestComplete works with standard controls.