Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Test Explorer is not finding my Unit Tests (XUnit.Runner) ASP.NET 5

I am using ASP.NET 5 with XUnit and Visual Studio is not finding my Tests in the test explorer.

I have rebuilt my project several times to get them to refresh. My test explorer is empty.

Any ideas?

Here is my project.json file:

{
  "version": "1.0.0-*",
  "description": "TestLibrary",
  "authors": [ "brivell" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "AutoFixture": "3.38.1",
    "AutoFixture.AutoMoq": "3.38.1",
    "BusinessLibrary": "1.0.0-*",
    "xunit": "2.1.0",
    "xunit.runner.dnx": "2.1.0-rc1-build204"
  },

  "frameworks": {
    "dnx451": { }
  }
}

Here is an example of one my my tests:

[Fact]
public void Traditional()
{
    // Arrange
    var sut = new Calculator();

    // Act
    sut.Subtract(1);

    // Assert
    Assert.True(sut.Value < 0);
}
like image 774
Blake Rivell Avatar asked Oct 22 '25 06:10

Blake Rivell


1 Answers

You need to install the package XUnit.Runner.Console in your test project in order for the test runner to discover your tests.

https://www.nuget.org/packages/xunit.runner.console

like image 173
Kenneth Avatar answered Oct 23 '25 21:10

Kenneth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!