Q: Is it possible to run xunit tests side-by-side with MSTest in VS 2013? If so, what am I doing wrong?
Background:
I've migrated a .NET Solution from VS 2012 format to VS 2013.
I was unable to get the xUnit tests to work. After much troubleshooting (experimenting with project types, MS Tools versions, creating new projects with just xUnit, and experimenting with xUnit versions and dependencies), I was able to narrow the problem down to having MSTests in the same project as xUnit tests. This worked before in VS 2012.
As soon as I include just one test method marked with the [TestMethod]
attribute, none of the xUnit tests will be run. They may appear in either the VS Test Explorer, or the ReSharper Unit Test Sessions panels, but they appear with either a [!] under Not Run Tests (for Test Explorer) or [?] (for Unit Test Sessions). Having a class with the [TestClass]
attribute, but not a method marked with [TestMethod]
still allows xUnit tests to run.
It may turn out that this is a bug in an xUnit component, but I'd like to see whether anyone else has had any experience to the contrary.
Note: nearly all unit tests are based on xUnit, the MSTest is just there as a proof-of-concept to ensure that it's supported in case MSTests are to be 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