Rank: Newbie
Groups: Registered
Joined: 5/19/2015(UTC) Posts: 2 Location: United States of America
Was thanked: 1 time(s) in 1 post(s)
|
I have some unit tests I need to skip so I was going to use a custom FactAttribute. This is causing the unit test discovery to throw an exception. I'm pretty sure this is an Xunit problem not an Ncrunch bug, but between the VS test runner, R# and teamcity I'm only seeing problems in NCrunch so I suspect it's a combo of an exception being thrown by xUnit that NCrunch could handle better. NCrunch failed to find ANY tests at all in a project with this attribute and crashed hard with the bug in the discoverer for that one test. Edit : when I wrote this I thought the xUnit prerelease version of the runner was working, but I lied. I think I just got a false positive as I was switching out nuget packages Exception is Code:
An error occurred while analysing this project after it was built: System.Exception: Error while discovering test 'XunitSkip.UnitTests.Skip_test':System.InvalidOperationException: Sequence contains more than one element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at Xunit.Sdk.XunitTestCase.Initialize()
at Xunit.Sdk.TestMethodTestCase.EnsureInitialized()
at Xunit.Sdk.TestMethodTestCase.get_SkipReason()
at nCrunch.Module.XUnit2.Integration.XUnitDiscoveryMessageSink.discoverTest(ITestCase testCase, Object[] arguments)
at nCrunch.Module.XUnit2.Integration.XUnit2TestFramework.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName)
at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, TestFrameworkDescription[] frameworks, ComponentUniqueName testComponentUniqueName)
at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(TestFrameworkDescription[] applicableFrameworks, ComponentUniqueName testComponentUniqueName)
App to reproduce is pretty simple. New console app, add xunit 2.0 and the Visual Studio Runner Code:
using Xunit;
namespace XunitSkip
{
public class UnitTests
{
[Fact]
public void Whatever()
{
Assert.True(true);
}
[Fact]
[Skip("skipping it")]
public void Skip_test()
{
Assert.True(true);
}
}
public sealed class SkipAttribute : FactAttribute
{
public SkipAttribute(string reason = "just cause")
{
Skip = reason;
}
}
}
|