Known Issues - .NET WPF

This topic describes troubleshooting and limitations for testing .NET WPF applications.

Object Identification

  • When you spy on a WPF object using the Object Spy (or the .NET Windows Forms Spy when the .NET Add-in is loaded), and the Record and Run Settings dialog box is not configured to record on the WPF application on which you are spying, UFT One recognizes the object as a standard Windows object.

    Workaround: Close your WPF application. In UFT One, open the Record and Run Settings dialog box (Record > Record and Run Settings) and in the Windows Application tab, select the Record and run test on any Windows application option. Reopen your WPF application and then spy on it again.

  • UFT One does not treat text block elements as children of WPF objects, such as lists, treeviews, and tables. Therefore, they will not be returned in a ChildObjects statement, nor will they be learned as test objects when you select to learn a WPF object and its children.

    If you want to work with the text block elements of a WPF object, use a GetItem() or GetItemProperty() statement.

  • When you spy on a WpfComboBox control on a Microsoft Windows 7 operating system, to enable displaying the correct all items property value, you must first manually expand and collapse the combo box.

  • To view the full type name of a .NET Windows Forms object in your application, view the SwfTypeName in the Object Spy.

    You can also view a list of the base types of a selected object by running a statement using the following syntax:

    MsgBox <SwfTestObj>(<descr>).GetROProperty("SwfTypeNames")  

    where SwfTestObj(<descr>) is the test object you want to check. Running this statement causes a message box to open displaying the actual class at the top of the list and the base classes below it.

  • If your Windows machine's Region settings are set to a Format (language) whose language pack is not installed, UFT One cannot record, run, or spy on WPF objects.

Back to top

Recording

  • When recording steps using low-level recording, default description properties for Windows Presentation Foundation test objects do not have constant values. This may lead to different description property values during a run session, which causes steps on these objects to fail.

  • When recording dynamically changing objects in your application, UFT One records the object properties of the object after the change instead of on the original object before the change. This causes run sessions using this object to fail.

    Workaround: Manually change the object description in the editor.

Back to top

Recognizing open .NET WPF applications

If you have restarted UFT One in between .NET WPF test runs, UFT One may not recognize the open application when you run your test again after the restart.

To avoid errors, add the following registry definitions on your UFT One machine:

  1. Navigate to the [HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\Packages\WpfPackage\Settings registry key

  2. Add a new sub-key named ProcNoCleanup.

  3. Add an empty string value to the [HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\Packages\WpfPackage\Settings\ProcNoCleanup key. The name of the value must be the name of your application.

    For example: "MyApp.exe"=""

Note: Some registry keys intentionally include previous company branding, due to backward compatibility considerations.

Tip: To enable this functionality for multiple processes, add additional lines in the same format under both keys.

Back to top

Windows display scaling (DPI)

UFT One version 2023 and later

You can test WPF applications regardless of your Windows display scaling settings. However, we recommend that you set the scaling level to 100% when using the following methods:

  • Run the MouseMove method to move the mouse pointer over the edge of a WpfButton object.

  • Run the Click method to click the edge of a WpfScrollBar object.

UFT One version 2022 and earlier

Using Windows display scaling other than 100% may cause UFT One to fail to identify objects in the correct locations of WPF applications.

See Windows display scaling (DPI).

Back to top