Open topic with navigation
In this section, you study the behavior of the control that you want to support and the way UFT recognizes it and interacts with it. You then determine what you need to customize in UFT's behavior in order to enable creating test steps that are more meaningful and easier to maintain.
Double-click the <WPF and Silverlight Add-in Extensibility SDK installation folder>\samples\WPFExtCalendarSample\Application\WpfCalendar.exe file. The Calendar application opens.
This application contains 3 controls:
A calendar display area with buttons: Microsoft.Windows.Controls.Calendar
A text label: System.Windows.Controls.TextBlock
An edit box displaying the selected date: System.Windows.Controls.TextBox
Study the application's functionality.
You can click the right and left arrows to go the next or previous month.
You can select a date in the calendar by clicking on the relevant day of the month.
You can view the selected date in the text box.
Open UFT, and open a GUI test.
Select Record > Record and Run Settings, and make sure that the selections in the Windows Applications tab enable UFT to record and run tests on the calendar application.
Run the Object Spy and spy on the WPF Calendar.
UFT recognizes the Calendar application as a WpfWindow. Within this window, it recognizes the Microsoft.Windows.Controls.Calendar control as a generic WpfObject and the System.Windows.Controls.TextBox as a WpfEdit object.
Additionally, within the in the Microsoft.Windows.Controls.Calendar control, UFT recognizes the days as independent WpfButtons in the WpfWindow.
UFT ignores other user interface elements contained in the Calendar control, such as the right and left arrows, and the month and year banner.
Open the Object Repository.
Click the Add Objects to Local button.
Click on an area in the calendar.
Add additional objects to the local object repository by clicking the Add Objects to Local button and then clicking on different areas of the calendar. For example, click on the days, the text box, the month and year banner, and so on.
UFT learns the application as a WpfWindow. Within this window, it separately learns the calendar display area as a generic WpfObject and the Selected Date box as a WpfEdit object.
The days are learned as independent WpfButtons, but other user interface elements, such as the right and left arrows, and the month and year banner, are not learned at all.
Click Record .
Click on different areas in the calendar.
When you click on the right or left arrows, or on the month and year banner, UFT records a generic click on the WpfObject, specifying the coordinates of the location you clicked.
When you click a day and select it, or when you click in the Selected Date box, nothing is recorded.
When you click in other areas of the application, UFT records a generic click on the WpfWindow.
For functional testing purposes, the Microsoft.Windows.Controls.Calendar control should be represented in UFT by one MyWpfCalendar test object.
The buttons within the Calendar control should not be treated as separate controls.
The Selected Date box is a read-only box, on which no user activity is possible and no steps are recorded. Therefore, the System.Windows.Controls.TextBox control does not have to be supported as part of the MyWpfCalendar test object, and does not need any customization for functional testing.
The MyWpfCalendar test object class should be based on the existing UFT test object class, WpfObject, and extend its capabilities.
The MyWpfCalendar test object class should support calendar-related operations.
In this tutorial you will develop support for the following test object methods: SetDate (default operation), Next, Previous, and a SelectedDate test object property.
User operations performed on the calendar's different user interface elements, should be interpreted and recorded as high-level operations on the calendar as a whole. For example: SetDate, Next, Previous, and so on.
The MyWpfCalendar test object class should support identification properties relevant for a calendar, such as is_today_highlighted.