Cannot run Xunit with Visual Studio 2013 Community

蓝咒 提交于 2019-12-14 03:53:44

问题


I'm trying to get XUnit to work with Visual Studio 2013 Community (Version 12.0.31101.00 Update 4).

I've got NUnit to work so I thought it would be simple to get XUnit to work.

The code is

using Xunit;

namespace Xunit
{
    public class Class1
    {
        [Fact]
        public void myFirstTest()
        {
            Assert.False(true);
        }
    }
}

I've used the NuGet Package manager to install the following.

XUnit.net is version 1.9.2

XUnit.net: Runners is version 1.9.2

I've seen videos of people running XUnit with VS2012 but no one with 2013.

Any ideas?


回答1:


You need to install the "xunit.runner.visualstudio" as a nuget package, currently in beta, so run in package manager console:

Install-Package xunit.runner.visualstudio -Pre

or look for it in the GUI, but do select "include prerelease" as explained in the new docs.




回答2:


OK - as of today, 20 Jan 2015, I have managed to get Xunit working on VS2013 Community with the stable 1.9.2 Xunit.net and the pre-release "Visual Studio Runner 2.0 RC1".

  • 1.9.2 Xunit visual studio runner, didn't pick up xunit tests in Test Explorer
  • 2.0RC1 Xunit.net installation fails complaining about filename/path is too long.

But the combination of 1.9.2 Xunit.net & 2.0RC1 Xunit Studio Runner works well for me. I guess tomorrow! or whenever they release the final version of Xunit, I can replace 1.9.2 Xunit.net with the latest.




回答3:


it may be the option under Test->Test Settings-> Keep test execution engine running. If you have both MSTEST and XUNIT, it has a problem switching.

Also if resharper is installed you can Uncheck enable unit tests through the options. though this seems to be mostly with resharper 8.1

Also found had to move xunits out of Test project and even then this is hit or miss.

keyword: executor://xunit/VsTestRunner2



来源:https://stackoverflow.com/questions/27844614/cannot-run-xunit-with-visual-studio-2013-community

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!