Test Studio recording feature supports WPF applications built with .Net 4.5+ or .Net Core 3.1 and above, and .Net 5. To be able to initiate recording session against specific application, you need to list its executable in the WPF test.
This article guides you through the WPF test configuration process.
- Configure WPF Test to Automate Specific App
- Set Default Project Path to WPF App
- Record Application Window State
- Finish WPF Test Configuration
The configuration of the WPF test requires an executable file of a valid WPF app to be specified and, thus, used for recording and execution. When you open a WPF test in Test Studio, you can see the Configure button in the Test tools ribbon. Click the Configure button to open the WPF Config Wizard.
If you attempt to initiate a recording session in WPF test, before it is configured, the WPF Config Wizard pops up and lets you provide the necessary details.
Test Studio provides few options to define the application to automate - you can browse to the folder, where the executable file is located; or if the application is started, you can directly select it from the list of active apps.
The WPF Application Path field allows you to drag and drop the application's shortcut icon into it, or click Browse and locate it manually in File Explorer.
The Active WPF Applications list displays all WPF apps currently running and detected by Test Studio. Click on the desired one and hit the Select Application button and this will populate automatically the path to the executable file in the WPF Application Path field.
Once an executable file is selected, the WPF Application Path and Current Path Expanded fields get populated accordingly. WPF Application Path supports environment tokens (i.e. %Program Files%\MyApp\App.exe) and when using such, the Current Path Expanded field displays the full path to the executable file.
The automation process requires multiple tests to be created for a single application. In such case configuring each created test will be a tedious task. Therefore Test Studio allows you to set a default WPF app path on project level and use this for all WPF tests. The option is available in Project Settings -> General and once a Default Path is set each new WPF test in the project will be configured to use it.
For WPF tests you can choose whether to record the changes in the application window state - Minimize, Maximize, Restore and Close actions can be captured automatically in the recording process. If the recording scenarios require to interact with the window state, you can enable the checkbox under the Recording Options section in the Config Wizard.
Recording the changes in the application window state is a setting on project level. So, if it is enabled for one test in the project, it will be also applied for all existing and newly created WPF tests in the project.
Once you applied all necessary settings, you can confirm the configuration by pressing the OK button. Then, when you hit the Record button, the configured WPF application will be launched and the recorder will be attached to it, so you can proceed with recording the test scenario.
In any case, when you need to change the applied settings, hit the Configure button to access the wizard again.