1

I am really from a Coded UI background and have started using Win App Driver to test a WPF application. Please forgive me if I am missing something about Win App Driver. The good news is that it works on my development machine!

When I developed Coded UI tests, I could copy my ordered tests and my test application dll to any machine, install VS Test Agent and run my tests there. That way, our customers etc can run our automated tests without having Visual Studio etc and VS Test Agent is free.

I ran the tests from a windows batch file like the one below.

C:
cd codedui
set mstestPath="C:\Program Files (x86)\Microsoft Visual 
Studio\2017\TestAgent\Common7\IDE"

%mstestpath%\mstest /testcontainer:WinAppD_OrderedTest- 
AcceptanceTest_Logon.orderedtest 

pause

My question is can I do this with my Win App Driver tests? I have tried and it said it couldn't find "appium-dotnet-driver.dll" and "WebDriver.dll", I copied them into the same folder as my ordered test, bat file etc and then it asked for another 3 dlls ("Newtonsoft.dll", "WebDriver.Support.dll" and "Castle.Core.dll"). I copied those 3 over as well.

Now it simply says it can't find "Castle.Core". What confuses me is that it asked for 5 dlls, I copied them and that fixed the problem for the first 4, why doesn't it find Castle.Core.dll? Alternatively, is there a simpler, more Win App Drivery way to do this?

Many thanks for any advice from a Coded UI tester who wants to make the transition to Web App Driver!

Ewan
  • 541
  • 8
  • 23

1 Answers1

0

Instead of manually copying files, it would be much better to configure your dependencies as nuget packages and then just perform a nuget restore on your remote server.

Microsoft provides the Appium.WinAppDriver nuget package which, when added to your UI test project, will provide all the required functionality to test your project.

If using version 4.0 of the package or greater, the docs on GitHub are slightly out of date. You should use the AppiumOptions() API to create a new session

// Set up the session
var opt = new AppiumOptions();
opt.AddAdditionalCapability("app", @"path/to/your/application.exe");
opt.AddAdditionalCapability("platformName", "Windows");
var session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), opt);

// Click a button
session.FindElementByName("MyButtonName").Click();

// Tear down
session.Close();
session.Dispose();
Dan
  • 1,805
  • 2
  • 18
  • 21