Search code examples
coded-ui-testsazure-pipelines-release-pipelinemicrosoft-test-managervstestvstest.console.exe

Can't run tests that interact with the desktop


I have downloaded and installed in a windows server 2016 a vs test agent, which was installed by a tool called Test Agent Configuration Tool. I then followed this guide to configure the agent to run tests that interact with desktop - I want to run CodedUI Tests for web projects from whithin my release pipeline.

This is the output from the Test Agent Configuration Tool enter image description here

When I run my release pipeline I get this error during the test phase:

Error calling Initialization method for test class Captura.PDV.Web.Test.CodedUI.CodedUITest1: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (https://go.microsoft.com/fwlink/?LinkId=255012)

If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (https://go.microsoft.com/fwlink/?LinkId=254735)

Here is my test task configuration:

enter image description here

Some notes and questions:

  • I can run the tests calling vstest.console.exe manually from within the server with success
  • My release pipeline runs on VSTS
  • I am not using Microsoft Test Manager - Is it really necessary?
  • Do I need to set up a test lab enviroment?
  • Do I need to have a controller for the agent?

I just want to run my tests in first place to see how it goes and then proceed to more advanced tests scenarios using MTM


Solution

  • You're mixed up between the old way of doing things and the new way.

    • You don't need to use MTM -- MTM is deprecated.
    • You don't need to set up a lab environment. Lab environments are deprecated.
    • You don't need special test controllers or agents.

    All you should need to do in order to run UI tests is:

    1. Set up a build/release agent that runs interactively.
    2. Run the tests on that agent with the Visual Studio Test task with the "Test Mix Contains UI tests" check box checked.

    That's it.

    I'd also recommend against using Coded UI and instead use Selenium (or Appium for desktop applications); Microsoft is no longer investing in the Coded UI platform and recommends using Selenium as an alternative.