1

I have developed a simple WPF applicaiton. I want to do some UI automation testing on my app. I started following this tutorial on how to do automation using Appium and Windows Application Driver.

As a part of setting up the test environment for testing Windows Calculator app, the following lines are added to the test script :

protected const string WindowsApplicationDriverUrl = “http://127.0.0.1:4723";

DesiredCapabilities appCapabilities = new DesiredCapabilities();

appCapabilities.SetCapability(“app”, “57b3a460–8843–4d84–822a-9f316274c2bf_tz6ph9wdjhqw8!App”);

IOSDriver<IOSElement> AppSession = new IOSDriver<IOSElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);

Looking at the 3rd line, an application identifier is provided to set DesiredCapabilities. My problem is that I have trouble finding or generating a similar app ID for my WPF application. Further down in the tutorial, author mentions:

"In the third line, we set a weird identifier for the “app” device capability. You need to replace this value with yours. It can be found the generated AppX\vs.appxrecipe file under RegisteredUserModeAppID node.

<RegisteredUserModeAppID>57b3a460–8843–4d84–822a-9f316274c2bf_tz6ph9wdjhqw8!App</RegisteredUserModeAppID>"

Can you tell me how this appID can be generated in Visual Studio? Also, is there other ways to set DesiredCapabilities without providing an appID? Can a GUID be used for this purpose?

Amir
  • 53
  • 5

2 Answers2

3

Only UWP apps have an application id, classic Windows applications can be started with the path to the executable:

appCapabilities.SetCapability("app", pathToYourExecutable);

See also the readme of WinAppDriver: Testing a Classic Windows Application

johh
  • 141
  • 1
  • 5
0

You should be able to find this when you're debugging your app. If you debug the app and set a breakpoint at the first instance.

Then in your debug tab you should be able to view the node you're looking for.

mvoase
  • 544
  • 1
  • 6
  • 20
  • Can you elaborate on that? I need an specific application id. How does setting a break point will help me with getting one? – Amir Nov 23 '17 at 17:13
  • Once you have built, you should find the file you need containing the id in here - "project_directory"\bin\x86\Debug\AppX\vs.appxrecipe. – mvoase Nov 23 '17 at 17:16
  • So just to give you an idea, I have solution which consists of 3 sub projects, each representing model, view and view-model for my application. Each one of these projects are stored in their separate folders under the solution folder. Now when I build my application in Debug/x86 mode, the executable for my project can be found under [Solution Folder]\ [view]\bin\Debug but AppX does not exist. My question is how to generate that? – Amir Nov 23 '17 at 17:35