A sample implementation is available on GitHub.
Appium is an opensource test framework for validating native and web apps. It can drive iOS, Android and Windows applications via the well-known Selenium WebDriver protocol.
Appium can be used from any tool, any language, any test tool and for any platform, if there are is a WebDriver for the platform and language-specific client libraries for the Selenium WebDriver API.
To run validations on the Windows platform Microsoft offers an opensource Windows Driver based on the WebDriver protocol. The Appium test framework works with this WebDriver protocol to control the actions on the application undertest.
Installing the Appium Windows Driver.
There are different ways to get the Appium Windows Driver on your Windows platform. Via installer packages delivered on the Microsoft GitHub project.
or via a node package https://www.npmjs.com/package/appium-windows-driver
With the driver alone, you’re not done yet. The Appium windows Driver takes care of the Appium actions translation to the Windows environment. A different driver will take the Appium actions on a different platform, happy decoupling.
Installing Appium can also be done on two different ways, via a installer package with the Appium Desktop and via a NPM package.
Installing both is an option, or better install the Desktop on the test authoring environment, it has the capability to inspect the application under test, and install the NPM Appium server on the test environment.
After the NPM the appium command will start the Appium server.
The Appium Desktop App comes with some additional capabilities next to start the server (which listens for request to execute on the driver). It also makes it possible to inspect your application undertest.
The desired capabilities are used to communicate the proper way with the driver, for Windows this is: Platform “Windows” and devicename “windowsPC” with for Store Apps the full app name and for desktop apps the location of the executable.
The xPath paths can come handy when authoring the tests. When the Appium inspector doesn’t bring you what you need you can use other inspectors. The Windows SDK comes with an inspector application which can be found in the programs file directory, Inspect.exe. https://msdn.microsoft.com/en-us/library/windows/desktop/dd318521(v=vs.85).aspx and there are more, see this list: https://github.com/blackrosezy/gui-inspect-tool
A good practice is to write the UI tests in the same language as the programming language used to write the system under test. I should be obvious to write the test in C#. To write Appium test in C# with you also need some additional Nuget packages from where the Appium Webdriver contains the necessary methods (in Appium.WebDriver.188.8.131.52\lib\net45\appium-dotnet-driver.dll ) for creating sessions to the Appium Server.
The same when you want to author your tests in Java, it requires an import from the io.appium.java_client.windows.WindowsDriver package.
Setting it up the same way as the Node samples in the Appium samples folder will result in these packages.
The capabilities you need to set to run the test cases are the same as the ones used for the inspect session. Platform “Windows” and devicename “windowsPC” with for Store Apps the full app name and for desktop apps the location of the executable.
The test case is a simple sequence of actions with a validation.
The testcases and environment are ready fir execution. Simply start the run via the command line. This works for desktop apps and for store apps. Don’t forget to set the Windows 10 environment in Developer mode.