This post is about how to implement UI Automation for your Universal(UWP) apps with Appium. Appium is an open source test automation framework for use with native, hybrid and mobile web apps. It drives iOS and Android apps using the WebDriver protocol. To start first you need to download the WinAppDriver.exe, you can download it from the GitHub repository. Download it and install it. Once installation completed, run the WinAppDriver.exe from the install location, by default it will be C:\Program Files (x86)\Windows Application Driver. When running WinAppDriver.exe a console window is opened which logs the JSON Wire Protocol HTTP requests, like this.
Now create a Test Project in Visual Studio, and add the reference of “Appium.WebDriver”. It will download all the required references and dependencies to write UI automated tests. For testing Universal Apps, you need to provide Application Id for the app under test in the app capabilities entry. The following code will launch the windows calculator, and verify whether it is successfully launched or not.
And the following code will find the Results text box and using that you can verify the results of various operations.
You can find the Id / Name of the control using Inspect.exe, which is part of Windows SDK, which is available under “C:\Program Files (x86)\Windows Kits\10\bin\x86” location.
Here is a simple addition test using Windows Calculator.
You can get the app id of the UWP app you’re developing, you can find it from Package App manifest tab in the project properties.
You need to appened “!App” while setting the capability. And if you’re trying to automate an app which is deployed in the Windows Store, you can get the Id from App Identity under App Management.
Here is the UI automation testing running on my system.
Appium also supports classic Windows Forms apps as well. For that you need to set the full path of the executable as the app capability.
This will launch notepad and type “This is some text” to the editable area.
Happy Programming :)
Did you like this article? Share it with your friends