All posts by Hassan Uraizee

Announcing UI Tests in CI/CD for Desktop App Developers – Windows Developer Blog

For many years the ability to run UI tests in CI/CD has provided great value to web developers. This past Microsoft Build 2019 we were excited to announce desktop app developers can now also run UI tests in Azure DevOps! Desktop applications can now run automated UI tests in CI/CD on Azure DevOps using hosted or private agents, and setup is simple with a new Pipeline task.

Continuous Integration (CI) enables you to run automated tests of your application every time there’s a code change, and typically on servers so you’re not tying up desktop machines for testing. App developers have had the ability to run UI tests using WinAppDriver, and adding these tests to CI is important for a couple key reasons:

UI tests need interactive test machines. If you attempt to move the mouse, type on the keyboard, on a machine while a UI test is running, you will likely invalidate the test. This is because the tests perform automated user interactions in a way that does not differentiate from your physical actions.
CI is the right time to run UI Tests. There’s great value in having UI tests confirm if code changes break the user experience in your application. But equally important to having UI tests, is running them for every code change and pull request so you know exactly which commit broke the behavior. A key tenet of CI is to run every time the code changes.

UI tests are automated tests designed to test an application by interacting with its UI in the same way a normal user would. These tests are different from unit/functional tests which test functional components of the application. A UI test typically involves going through an application in common scenarios just like a user would, verifying a user can accomplish common tasks. UI tests also typically record screenshots and often video of the test so the developer can review how the application appeared at various moments in the test.

For app developers to run UI tests in CI, the machine running the tests must be in an interactive state. This means the operating system has a logged in user and is listening for user input. You also need a test runner such as WinAppDriver on the test machine. Setting up a private agent in Azure DevOps with this configuration was possible, but it required significant manual configuration. Many customers requested enabling the hosted agent pool with a simple solution. The HostedVS2017 and HostedVS2019 agents are now updated with the following to enable UI tests in CI:

Support for interactive mode
Addition of WinAppDriver which executes the UI test commands

Both agents are included for free in the base Azure Pipelines plan.
In addition to the hosted agent additions there’s now a task in Azure Pipelines for easy addition of UI tests and added test configuration options. A preview of the WinAppDriver task is available today on the DevOps Marketplace. If you’re using the Classical Editor, search for “WinAppDriver” from the Add tasks menu:

For more information on the task, check out the updated CI with Azure Pipelines section on our Wiki.

The recently open-sourced Microsoft Calculator project has UI Tests running in Azure DevOps as part of their CI. These tests are helping the Calculator Team catch PRs that break the user experience.
You can check out their DevOps CI/CD Pipeline fully integrated with the new WinAppDriver Task seen here:

Please take a look at Calculator and evaluate if adding UI tests in CI/CD will help your desktop application projects.
We’d love to hear from you. Please reach out on the WinAppDriver Issues Board on GitHub, or email [email protected] For product announcements follow @mrhassanuz and @yosefdurr.
Updated May 14, 2019 1:27 pm

Introducing WinAppDriver UI Recorder – Windows Developer Blog

A new open-sourced tool is now available for the Windows Application Driver (WinAppDriver) community: the WinAppDriver UI Recorder tool. This tool will enable users to easily create automated UI tests.For those of you not familiar with WinAppDriver, it is a UI automation service for Windows 10 that users can use to test their applications. We recently released our v1.1 preview that you can read more about here.
What is UI Recorder
For many in the WinAppDriver community, Inspect has been the most common tool for users to select UI elements and view their attribute data. Though Inspect serves its intended purpose of viewing accessibility data, it falls behind when it comes to supporting scenarios specifically for UI automation, such as being able to generate XPath queries.
For situations such as these, the WinAppDriver UI Recorder tool hopes to fill in the gaps from Inspect and serve as its alternative.
As for its initial release, the UI Recorder tool will enable the following two key scenarios:
1) Inspecting UI elements and retrieving their XPath expressions
2) Generating C# code for certain actions (mouse click) when “Record” is active
Generated Code can be pasted into the UI Recorder Template folder for WinAppDriver playback
We’re hoping that with this tool, users will have a simpler and more intuitive approach in writing automation scripts for WinAppDriver.
Getting Started
The code for the UI Recorder is open-sourced and available on WinAppDriver’s GitHub repo here. It’s recommended to use Visual Studio 2017 to start building and compiling it. Once compiled, you can immediately start using UI Recorder.
In addition to access to the source, a zipped executable can be found here on our GitHub Releases section.
Using UI Recorder
The UI Recorder tool aims to provide an intuitive, and simplistic, user interface that is divided into two panels, as seen below:

UI Recorder tracks both keyboard and mouse interactions against an application interface—representing a UI action. When Recording is active, both the top and bottom panels are dynamically updated with varying UI element information every time a new UI action takes place. The Top Panel shows the generated XPath query of the currently selected UI element, and the Bottom Panel shows the raw XML information for the same element. You can navigate to the C# Code tab on the bottom panel to view generated C# code of the recorded action which you can use on a WinAppDriver test.
The following animation provides an example of the recording process:

The code recorded can be coped over to the clipboard and pasted onto the WinAppDriver UI Recorder template project to be replayed.
Providing Feedback
With the UI Recorder tool being open-source, we highly encourage the community to submit any PRs with changes or enhancements, and to post suggestions on how they would like to see the UI Recorder grow.
Please use the GitHub Issues Board to provide any feedback on the UI Recorder tool – we look forward to hearing about any suggestions, feature requests, or bug reports!
Staying Informed
To stay up to date with WinAppDriver news follow @mrhassanuz.
A new tool for WinAppDriver is available now: UI Recorder. Now users have an intuitive way automate UI with WinAppDriver by not only being able to generate XPath expressions on the fly, but also C# code from by recording UI action events through mouse clicks.
Updated June 20, 2018 4:55 pm