user3239349
user3239349

Reputation: 917

C# UWP Visual Studio 2017 Unit Tests

I am creating Unit Tests for my app, using Visual Studio 2017 version 15.6.1.

I have added a new project, Unit Test Project (Universal Windows).
Project target version is Fall Creators Update (10.0; Build 16299)
Minimum version is November Update (10.0; Build 10586)

I have edited UnitTest1.cs as bellow:

[TestClass]
public class UnitTest1
{
    [TestMethod]
    public void TestMethod1()
    {
        Assert.AreEqual(0, 0);
    }

    [TestMethod]
    public void TestMethod2()
    {
        Assert.AreEqual(0, 0);
    }
}

In Test Explorer on the left side I see both of tests. I click on Run All.

There is just one window popups, and in Output there is this info:

[3/13/2018 4:13:24 PM Informational] ------ Load Playlist started ------
[3/13/2018 4:13:24 PM Informational] ========== Load Playlist finished (0:00:00.0155005) ==========
[3/13/2018 4:15:01 PM Informational] ------ Run test started ------
[3/13/2018 4:16:10 PM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Failed to initialize client proxy: could not connect to test process.
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)
[3/13/2018 4:16:10 PM Informational] ========== Run test finished: 0 run (0:01:09.0679372) ==========
[3/13/2018 4:39:20 PM Informational] ------ Run test started ------
[3/13/2018 4:40:43 PM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Failed to initialize client proxy: could not connect to test process.
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)
[3/13/2018 4:40:45 PM Informational] ========== Run test finished: 0 run (0:01:25.1648961) ==========

What am I doing wrong here?

Project link: https://ufile.io/8vifz

Upvotes: 4

Views: 671

Answers (1)

Vincent
Vincent

Reputation: 3746

There is one thread available from here which present a workaround for this issue:

You can try to run CheckNetIsolation.exe LoopbackExempt -c in an elevated command prompt.

It worked on my side.

Upvotes: 2

Related Questions