3

When I try to run my Windows Phone 10 Test on a machine using vstest.console.exe, the emulator starts as expected and the test completes successfully.

Now, when I set-up a build machine and kick off a TFS vNext build from a remote machine, the test fails with the following error:

Error: Could not start test run for the tests for Windows Phone app: Unit tests for Windows Store apps cannot be run from a service or non interactive process. Please run unit tests from an interactive process..

Researching online, I found that this is an expected behavior to enable Session-0 isolation.

  • What is the workaround/solution to be able to run Windows Phone Tests on a remote build machine successfully?

Thanks.

Darth.Vader
  • 5,079
  • 7
  • 50
  • 90
  • _"What is the workaround/solution"_ - use the _Force_ –  Dec 08 '15 at 02:48
  • Sorry, can you elaborate on that? I hope it is not a joke! :) – Darth.Vader Dec 08 '15 at 07:16
  • 2
    Sorry, I could not resist. :) Check out _Enable your build agent to run unit tests_ under [Build and test a Windows Store app using Team Foundation Build](https://msdn.microsoft.com/en-us/library/hh691189.aspx). Sounds like you just need to activate **Run the service interactively** –  Dec 08 '15 at 07:24
  • @Micky: May the force be with you! :) Thanks for your suggestion, but, I am using "TFS Build vNext" (that comes with Visual Studio 2015). Where can I enable my build agent to run in interactive mode for TFS vNext? – Darth.Vader Dec 08 '15 at 08:24
  • 1
    And you Darth :) Sorry I've not used _vNext_ sadly –  Dec 08 '15 at 08:28

1 Answers1

4

By default your build agent runs as a service. This means that it runs completely in the background and doesn't interact with the UI.

To run Coded UI Tests (or any other test that interacts with the UI), you need to run the build agent in Interactive Mode. This means the build agent launches as an actual program that you can see running. Running in this mode, the agent can interact with the UI.

You can edit the properties of an existing build agent through the TFS Admin Console and enable the 'Run the Service interactively'. After restarting the machine, the agent is now capable of running UI tests.

See Enable your build agent to run unit tests for more information.


Update

To install the vNext Agent as a service you first need a build machine. This can be any machine that's connected to the internet. On this machine you install the required tools to build your application (such as Visual Studio, Azure SDK etc.).

You then download the Agent installation from: https://.visualstudio.com/_admin/_AgentPool

Unzip the file, go to an elevated command prompt and run ConfigureAgent.cmd. You need to supply all the required values or accept the default ones. The step that's important for your is highlighted in the following screenshot:

vNext installation screenshot

You need to select No to make sure that the Agent doesn't run as a service. After that, finish the configuration. Make sure to use this Agent for your build.

Community
  • 1
  • 1
Wouter de Kort
  • 39,090
  • 12
  • 84
  • 103
  • Thanks, Wouter! I am using "TFS Build vNext" (that comes with Visual Studio 2015). Where can I enable my build agent to run in interactive mode for TFS vNext? – Darth.Vader Dec 08 '15 at 08:23
  • Check https://msdn.microsoft.com/en-us/Library/vs/alm/Build/agents/windows You can start the agent after installation by running Agent\VsoAgent.exe – Wouter de Kort Dec 08 '15 at 11:30
  • thanks for the link, but that link does not tell *how* to set-up the agent to not run as a service, but instead run interactively. Any thoughts? – Darth.Vader Dec 08 '15 at 12:40