Roddeck
Roddeck

Reputation: 45

Visual studio cannot discover tests (xunit)

I have a problem with visual studio 2015 for Web while discovering tests. I wrote simple .Net core application, added project with test, my project.json looks like this:

{
  "version": "1.0.0-*",

  "dependencies": {
    "xunit": "2.3.1",
    "xunit.runner.visualstudio": "2.3.1",
    "dotnet-test-xunit": "2.2.0-preview2-build1029"
  },
  "testRunner": "xunit",
  "frameworks": {
    "net461": {
    }
  }
}

Then in my test project i wrote first test:

using Xunit;

namespace Tests
{
    public class Class1
    {
        public Class1()
        {

        }

        [Fact]
        public void HelloWorld()
        {
            Assert.True(true);
        }
    }
}

When I build solution my test is not discovered and I get this message in test output window:

------ Discover test started ------
========== Discover test finished: 0 found (0:00:00,0475339) ==========
------ Discover test started ------
An exception occurred while test discoverer 'DotNetTestDiscoverer' was loading tests. Exception: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
========== Discover test finished: 0 found (0:00:00,0145118) ==========

And the funny thing is there isnt even Newtonsoft.Json with version 6.0.0.0.

I tried the following:

  1. Change test architecture to x64
  2. Start visual studio as administrator
  3. Reopen VS
  4. Delete %TEMP%/VisualStudioTestExplorerExtensions folder
  5. Create new project
  6. Change both tests and project architecture to x86

Note: When I run dotnet test it works fine, but I'd like to have my tests in tests window, because I cannot debug tests from the console.

Edit: I've created repository causing the problem, feel free to look it up: https://github.com/Rodeck/XunitIssue

Edit2: Im using .netcore sdk version 1.0.0-preview2-003131.

Upvotes: 3

Views: 574

Answers (1)

Roddeck
Roddeck

Reputation: 45

Problem solved - xunit doesn't support visual studio 2015 express edition.

Upvotes: 1

Related Questions