vstest icon indicating copy to clipboard operation
vstest copied to clipboard

UWP unit test application launches but it never runs tests or exits

Open JamesNK opened this issue 9 years ago • 8 comments

Description

I am attempting to run UWP unit tests using vstest.console.exe. The unit test application successfully deploys and launches but it never runs any unit tests (I placed a break point in a test and it was never hit) or completes. The unit test application UI stays until it is manually closed. The OS it is failing on is Windows Server 2016. The latest version of VS2015 and UWP tools are installed on the VM. I get the same result when I run unit tests from the VS2015 UI as I do when calling vstest.console.exe directly.

The same tests successfully pass on my Win10 development environment so I'm guessing it is something environmental about Windows Server 2016 - or how it is configured - that is causing the tests to never pass.

Steps to reproduce

  1. Windows Server 2016
  2. Open VS2015 and create new UWP test project
  3. Execute tests in UWP test project

Expected behavior

  1. Tests execute, runner closes, results are reported in VS2015

Actual behavior

  1. Test runner never executes tests or closes

Environment

Windows Server 2016 VS2015

JamesNK avatar Feb 17 '17 05:02 JamesNK

Runner hangs open like this:

1000210

JamesNK avatar Feb 17 '17 05:02 JamesNK

@JamesNK . Did this ever work in Windows Server 2016

saikrishnav avatar Feb 20 '17 06:02 saikrishnav

SampleTest.zip @JamesNK I uploaded a zip file with 2 projects - SampleTcpServer, TcpClientApp. SampleTcpServer is a simple desktop console app which launches a TCP server and waits for connection. TcpClientApp project is a UWP blank app project which contains a TCP client and connects to the desktop TCP server.

  1. Start the Server app first. It should say - Hosting @ 127.0.0.1....
  2. Start the TCP client app (Ctrl + F5) from VS - Click "Connect Server" button on the app ui. It should either say - "Connection Established" or throw some error relating to connection failure.

This would help us diagnose the issue. we use a simple TCP server-client model like this to trigger test run after the test app launches. My guess is that connection is not happening and our UWP test app is forever waiting on the connection.

saikrishnav avatar Feb 20 '17 07:02 saikrishnav

I ended up deleting the Server 2016 VM and replacing it with a Win10 VM that doesn't have any issues. I can't give any more information.

JamesNK avatar Mar 16 '17 06:03 JamesNK

Is there any other solution someone can recommend? I am encountering the same exact problem. Additionally, when I try to view the tests with /ListTests, I get this output:

Error: An exception occurred while test discoverer 'MSAppContainerTestDiscoverer' was loading tests. Exception: Specified method is not supported.

Error: An exception occurred while test discoverer 'MSPhoneTestDiscoverer' was loading tests. Exception: Specified method is not supported.

Additionally, the UWP Tests work with no issues on Windows 10, so it appears to be something with Windows Server 2016. Only difference with above post is that I have VS2017 on the VM.

I would really like to avoid the need to provision entirely new VMs for this.

achocron avatar Jun 07 '17 00:06 achocron

@saikrishnav I have the same issue, here is the error message from your test App : System.ServiceModel.EndpointNotFoundException: 'No IPEndpoints were found for host 127.0.0.1.' I hope it will help to find the root cause of this issue.

mhandb avatar Aug 28 '17 03:08 mhandb

This is being tracked external to this repo here: https://developercommunity.visualstudio.com/content/problem/145941/uwp-unit-test-application-launches-but-it-never-ru.html

snkota avatar Nov 07 '17 12:11 snkota

@JamesNK , the issue is because we use wfc communication over sockets to connect UWP app with VS IDE / vstest.console. For some it seems that connection is blocked.

However in V2017.5 we have introduced a new Testplatform, which uses raw sockets to establish communication. For UWP it is still underneath a feature flag, & we plan to make it default by 15.6 It works fine with UWP test apps.

To try out the preview bits of this for UWP, please edit your csproj, & change value of "UnitTestPlatformVersion" to 15.5, please clean, & do a rebuild.

mayankbansal018 avatar Dec 08 '17 09:12 mayankbansal018