Planning support for the WPF Calendar control

Supported on versions 2021 R1 and earlier

In this section, you study the behavior of the control that you want to support and the way OpenText Functional Testing recognizes it and interacts with it. You then determine what you need to customize in OpenText Functional Testing's behavior in order to enable creating test steps that are more meaningful and easier to maintain.

Run the sample WPF Calendar application and study its behavior

  1. Double-click the <Extensibility_installdir>\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

  2. 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.

See how OpenText Functional Testing recognizes the controls

Use the Object Spy in OpenText Functional Testing to see how the controls in the Calendar application are recognized:

  1. Open OpenText Functional Testing, and open a GUI test.

  2. Select Record > Record and Run Settings, and make sure that the selections in the Windows Applications tab enable recording and running tests on the calendar application.

  3. Run the Object Spy and spy on the WPF Calendar.

    The Calendar application is recognized as a WpfWindow. Within this window, the Microsoft.Windows.Controls.Calendar control is recognized as a generic WpfObject and the System.Windows.Controls.TextBox as a WpfEdit object.

    Additionally, within the in the Microsoft.Windows.Controls.Calendar control, the days are recognized as independent WpfButtons in the WpfWindow.

    The other user interface elements contained in the Calendar control, such as the right and left arrows, and the month and year banner, are ignored.

Add test objects for the Calendar control

Learn the Calendar control using OpenText Functional Testing, adding it to an object repository:

  1. Open the Object Repository.

  2. Click the Add Objects to Local button.

  3. Click on an area in the calendar.

  4. 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, or the month and year banner.

    The application is learned as a WpfWindow. Within this window, the calendar display area is learned as a generic WpfObject and the Selected Date box is learned 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.

Record a test on the Calendar control

  1. Click Record .

  2. Click on different areas in the calendar.

    When you click on the right or left arrows, or on the month and year banner, a generic click is recorded 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, a generic click is recorded on the WpfWindow.

Conclusion: Develop a MyWpfCalendar Test Object Class

  • For functional testing purposes, the Microsoft.Windows.Controls.Calendar control should be represented in tests 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 WpfObject test object class and extend its capabilities.

  • The MyWpfCalendar test object class should support calendar-related operations.

    In this tutorial you 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.

Continue to Setting up the extensibility project for the WPF Calendar control.