Visual Studio 2013 - can no longer run xunit tests side by side with MSTest

Q: Can I run xunit tests side by side with MSTest in VS 2013? If so, what am I doing wrong?

Background:

I migrated the .NET solution from VS 2012 format to VS 2013.

I failed to get xUnit tests to work. After significant troubleshooting (experimenting with project types, versions of MS Tools, creating new projects only with xUnit and experimenting with xUnit versions and dependencies), I was able to narrow down the problem to the point that MSTests in the same project as xUnit tests. This worked until VS 2012.

As soon as I enable only one test method marked with the [TestMethod] attribute, none of the xUnit tests will run. They can appear either in VS Test Explorer or in the ReSharper Unit Test Sessions panels, but they appear either using [!] In the "Do Not Run Tests" section (for the test explorer) or [?] (For Unit Test Sessions). Having a class with the [TestClass] attribute, but not the method marked [TestMethod] , still allows you to run xUnit tests.

It may turn out that this is an error in the xUnit component, but I would like to see if anyone else had the opposite.

Note. almost all unit tests are based on xUnit, MSTest is just there as a proof of concept to ensure that it is supported in case MSTests is used later.

Code excerpts:

MSTest:

 using Microsoft.VisualStudio.TestTools.UnitTesting; namespace YYY.XXX.Test.Unit { [TestClass] public class MSTests { [TestMethod] public void Test_Blah() { Assert.AreEqual(2, 2); } } } 

XUnit:

 using Xunit; namespace YYY.XXX.Test.Unit { public class FactTests { [Fact] public void Test_Blah() { Assert.Equal(2, 2); } } } 

SW versions:

  • MS Visual Studio Ultimate 2013 12.0.210051 REL
  • JetBrains ReSharper 8.1
  • xUnit.net runner for Visual Studion 2012 and 2013 v0.99.2
  • ReSharper extension:
    • xUnit.net Test Support v1.3.0
  • xUnit Project Packages:
    • xunit.1.9.2
    • xunit.extensions.1.9.2
+6
source share
1 answer

Resharper xunit / vstestrunner fix task: (For a long time it was necessary to see this too) You can get resharper 8.2 or higher.

  • Or - One disable restart tests
    In VS, click Resharper -> Options -> Unit tests - Uncheck the Enable unit tests box.

and

Testing → Testing settings-> Uncheck the box Keep the test engine running.

This should allow you to start both engines. I think what happens is that when it starts, it stays, and it's hard to get another to work.

keyword: executor: // xunit / VsTestRunner2

0
source

All Articles