Open topic with navigation
This task describes how to create, deploy, and test a toolkit support set to extend UFT's support for a set of WPF or Silverlight custom controls.
You must create separate support for WPF and Silverlight controls. However, creating support for Silverlight controls is very similar to creating support for WPF controls, therefore both are described together in this task.
Start by creating a basic toolkit support set with one test object class and minimal functionality changes, and testing that UFT recognizes it correctly. Then gradually add more complex support and more test object classes, and test those as you add them.
To create your WPF or Silverlight Add-in Extensibility files, use the UFT WPF CustomServer or UFT Silverlight CustomServer project template that the WPF and Silverlight Add-in Extensibility SDK installs on Visual Studio.
Using this template helps set up the XML files and the custom server classes that you need to develop in your toolkit support set, simplifying the first three steps in the task described below. For details, see WPF/Silverlight Custom Server Setup Dialog Box (in Microsoft Visual Studio).
Create a test object configuration XML file named <custom toolkit name>TestObjects.xml.
After you deploy your support, UFT displays this name in the Add-in Manager as a child add-in under the WPF add-in. Therefore, you may want the name to indicate whether this is a WPF or Silverlight toolkit.
In the test object configuration XML file, define new test object classes.
When creating support for WPF controls, create test object classes that extend existing UFT WPF test object classes (or other WPF Add-in extensibility test object classes).
When creating support for Silverlight controls, create test object classes that extend existing UFT Silverlight test object classes (or other Silverlight Add-in extensibility test object classes).
For details on the structure and syntax of a test object configuration file, see The Test Object Configuration XML File.
In a toolkit configuration XML file, map the custom control types to the test object classes that should represent them in UFT and to the custom servers that contain the implementation of your support. Create a Control element for each type of control you want to support.
Name the file <custom toolkit name>.cfg.
For details on the structure and syntax of a toolkit configuration file, see the Toolkit Configuration Schema.
WPF Toolkit Configuration File Example:
<?xml version="1.0" encoding="UTF-8"?> <Controls> <Control Type="MyCompany.MyDataGrid" MappedTo="MyWpfTable“> <CustomServer> <Component> <DllName>WpfCustomServers.dll</DllName> <TypeName> MyCompany.MyWpfDataGridCustServer </TypeName> </Component> </CustomServer> </Control> </Controls>
Silverlight Toolkit Configuration File Example:
<?xml version="1.0" encoding="UTF-8"?> <Controls> <Control Type="MyCompany.MyDataGrid" MappedTo="MySlvTable“> <CustomServer> <Component> <DllName>SlvCustomServers.dll</DllName> <TypeName>MyCompany.MySlvDataGridCustServer, SlvCustomServers, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null </TypeName> </Component> </CustomServer> </Control> </Controls>
Design one custom server for each type of control that you want to support.
For details, see How to Develop a Custom Server.
If you have completed the development and are deploying the support set for general use, make sure to set the DevelopmentMode attribute of the TypeInformation element in the test object configuration file to false.
Deploy the toolkit support set by copying the files that you created to the correct locations under the UFT installation folder. For details, see Developing UFT Support for a Custom WPF or Silverlight Toolkit.
Open UFT. Ensure that your custom toolkit name is displayed in the Add-in Manager dialog box as a child of the WPF Add-in, and select it. (If the Add-in Manager dialog box does not open when you open UFT, see the Micro Focus Unified Functional Testing Add-ins Guide for instructions.)
Note: If you are working with Silverlight, you must also select the Silverlight Add-in.
Create and run UFT tests on your custom controls, and verify that UFT interacts with your controls as expected. Make sure that:
Controls are represented by the expected test object class in the Object Spy and when learning objects.
You can successfully create test objects of the classes you defined, using the Define New Test Object dialog box.
You can successfully create test steps using your test object classes in the Keyword View, Editor (using the statement completion functionality), and Step Generator.
Operations run correctly. Check the run support exposed by the classes based on CustomServerBase (Click, DblClick, on so on). Verify that operations that are not implemented by the custom server are supported by the default UFT implementation for the base test object type.
Table checkpoints and output values function correctly (if relevant).
Identification property values are retrieved correctly. Check that identification properties not specifically implemented by the custom server are supported by the base class implementation (when relevant).
Operations are recorded correctly both when record implementation is based on Windows messages and when based on events.
If you are developing support for a Silverlight control, check that the correct messages are passed to the server, according to the Windows message filter defined by the custom server.
Your toolkit and its test object classes are properly displayed in the relevant UFT dialog boxes: Object Identification, Available Keywords (for application areas), Define New Test Object, and so on.
Check that elements of WPF or Silverlight that are not part of your support set have not had their functionality changed by installation of your support set.
Verify that low level controls that are part of a high level control, as defined in the IComponentDetector implementation are not recognized by UFT during Record, Learn, Spy, and so on.
To use Microsoft Visual Studio debugging tools to debug the support that you developed, attach Visual Studio to the application that contains the custom WPF or Silverlight controls, as the custom servers run in the context of this application.