UI Tests for Desktop and UWP Apps

Sign in to queue

The Discussion

  • User profile image
    PHBeagle

    Good video.  Thank you for sharing.

    Is CodedUI the preferred way to do testing of apps in Windows 7 then?  But for Windows 10, we would start using WinAppDriver?

    For CI/CD of web UIs, we're currently using test cases in Azure DevOps (VSTS) that our test automation code links to (the test case is called, which will run the code linked to it).  In order to put WinAppDriver into a pipeline, we would need to do something similar, correct?

    CodedUI required VS enterprise edition.  Does WinAppDriver have any similar requirements?  Since most is open source, it should be good with Community edition?

  • User profile image
    rogreen

    @PHBeagle

    WinAppDriver is the recommend solution for app testing on Windows 10. For Windows 7, CodedUI support will be limited but will continue to be the preferred way for app testing.   

    VSTS Test Tools Roadmap (this hasn't changed much from 2016):

    Coded UI is a fully supported feature. With the WebDriver becoming a W3C standard, we are actively encouraging customers to use Selenium for web-apps and with the WinAppDriver becoming available for Windows apps, to use Appium for Windows apps. As such, our investments in Coded UI will be selective and limited to supporting customers on any issues they encounter. We will be improving our support for authoring and running WebDriver based Selenium and Appium tests.

    ----------------------

    We're currently in talks with the DevOps team to simply the process of integrating with WinAppDriver. Though as of right now, you can employ the use of custom agents to set WinAppDriver up in a CI/CD environment.

    ------------------------------

    WinAppDriver isn't open-sourced itself, though samples / tests (using WinAppDriver) and supplementary tools are and available on our GitHub repo.


    To specifically answer your question, WinAppDriver can work with any IDE,  whether it's Visual Studio Community/Professional/Enterprise, or whether if it's Eclipse, Python, and so forth.


    This is due to WinAppDriver being based on an open standard (Web Driver), and as such the Test Writing part is abstracted away from the Test Runner part (WinAppDriver/Appium server), allowing you to use any language/IDE/platform you want to remotely or locally drive automation on your Windows 10 target device.

  • User profile image
    Jshardman

    What's the strategy for cross-platform testing of Xamarin.Forms apps, that run on Android, iOS and UWP (and possibly WPF)? UITest does Android and iOS, but currently not UWP (or WPF). Is there any plan to either make WinAppDriver do Android and iOS, or UITest to do UWP (and WPF), or another tool altogether?

  • User profile image
    Ewan

    I am using the AlarmClockTest project, downloaded from NuGet. There are missing references. Can you please tell me what NuGet packages I need?

    Many Thanks
    Ewan

  • User profile image
    Ewan

    Actually with reference to my last comment, I found the answer myself. I had to restart my PC (as the steps below didn't work until I had restarted) and then I had to use NuGet to Uninstall and then install Castle.Core, appium-dotnet-driver and a few other references...

  • User profile image
    Ewan

    In the video at 6:19, why is the url "http://127.0.0.1:4723"? Am I right in thinking this the url to test an app on the current machine / localhost? If so why is the port 4723? What do I have to do to ensure that port is ready and listening and that the url + port will actually launch the application? I have the solution and it stops at line 43 in AlarmClockSession.cs, the error is below...

    Test Name: AlarmAdd
    Test FullName: AlarmClockTest.ScenarioAlarm.AlarmAdd
    Test Source: C:\Users\ECombe.OPTIDOORS\Documents\SynTQCodedUITesting\AutoTest_SynTQ\SCN_Alarm.cs : line 30
    Test Outcome: Failed
    Test Duration: 0:00:00

    Result StackTrace:
    at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
    at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
    at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
    at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
    at OpenQA.Selenium.Appium.AppiumDriver`1..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
    at OpenQA.Selenium.Appium.Windows.WindowsDriver`1..ctor(Uri remoteAddress, DesiredCapabilities desiredCapabilities)
    at AutoTest_SynTQ.UnitTestSession.Setup(TestContext context) in C:\Users\ECombe.OPTIDOORS\Documents\SynTQCodedUITesting\AutoTest_SynTQ\UnitTestSession.cs:line 28
    at AlarmClockTest.ScenarioAlarm.ClassInitialize(TestContext context) in C:\Users\ECombe.OPTIDOORS\Documents\SynTQCodedUITesting\AutoTest_SynTQ\SCN_Alarm.cs:line 91
    Result Message:
    Class Initialization method AlarmClockTest.ScenarioAlarm.ClassInitialize threw exception. OpenQA.Selenium.WebDriverException: OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:4723
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
    --- End of inner exception stack trace ---
    at OpenQA.Selenium.Appium.Service.AppiumCommandExecutor.Execute(Command commandToExecute)
    at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters).

  • User profile image
    Ewan

    I also wondered how we can verify that "app" and "Microsoft.WindowsAlarms_8wekyb3d8bbwe!App" are the correct values. I have little idea why these strings are set to those values.

    Many Thanks
    Ewan

  • User profile image
    Ewan

    Sorry, me again. When I launch WinAppDriver.exe it closes less than a second later. It this a problem? In your video, the CMD window appears to remain open. The fact that mine closes, explains why I was unsure about the url and port "http://127.0.0.1:4723" as these are displayed on your WinAppDriver window but disappear immediately from mine.

    Is this a known problem and is am I right in thinking that the WinAppDriver CMD window is required to stay open for this test project to work?


    Many Thanks
    Ewan

  • User profile image
    shaovoon

    Is there a way to add AutomationId to win32 or MFC controls? For Winform, instead of deriving every control and adding the AutomationId property, is there a way of forcing the tool to use the combination of form name and control member name as the AutomationId property?

Add Your 2 Cents