Build/Test Issues

NCrunch and xUnit Theory Display

Started by Micah71381 on 5,382 views

I have an xUnit 1.9.2.1705 PropertyData Theory that contains a dozen or so test cases. NCrunch is able to run the theory and all of the tests, but they all show up as a single test in NCrunch, rather than a dozen or so separate tests. When I click on the test in the NCrunch Tests window, I see all of the tests show up in the output panel of the form:

Xunit.Sdk.TrueException: Assert.True() Failure
   at MyNamespace.Tests.MyClassTests.when(TestCase testCase) in C:\Users\Micah\Source\MyNamespace.MyClass\MyNamespace.MyClass.Tests\MyClassTests.cs:line 396

when(testCase: everything enabled, no include/exclude):

*** Failures ***

Exception
Xunit.Sdk.TrueException: Assert.True() Failure
   at MyNamespace.Tests.MyClassTests.when(TestCase testCase) in C:\Users\Micah\Source\MyNamespace.MyClass\MyNamespace.MyClass.Tests\MyClassTests.cs:line 396
Xunit.Sdk.TrueException: Assert.True() Failure
   at MyNamespace.Tests.MyClassTests.when(TestCase testCase) in C:\Users\Micah\Source\MyNamespace.MyClass\MyNamespace.MyClass.Tests\MyClassTests.cs:line 400

when(testCase: browser monitoring attributes disabled by default):

*** Failures ***

Exception
Xunit.Sdk.TrueException: Assert.True() Failure
   at MyNamespace.Tests.MyClassTests.when(TestCase testCase) in C:\Users\Micah\Source\MyNamespace.MyClass\MyNamespace.MyClass.Tests\MyClassTests.cs:line 400


when(testCase: attributes globally disabled):



when(testCase: all categories disabled):



when(testCase: global exclude):



when(testCase: exclude in each category):

Xunit.Sdk.TrueException: Assert.True() Failure
   at MyNamespace.Tests.MyClassTests.when(TestCase testCase) in C:\Users\Micah\Source\MyNamespace.MyClass\MyNamespace.MyClass.Tests\MyClassTests.cs:line 396


I would much prefer the tests named "when(testCase: all categories disabled)" etc. show up in the test list, and also count toward the failure counter.
Hi, thanks for posting.

NCrunch is reliant on Gallio for discovering and executing Xunit 1.x tests. Unfortunately, due to the design of its Xunit adapter, Gallio's reporting does not provide this level of granularity when working with theories. This means that NCrunch isn't able to differentiate between the test cases and will group them together.

From Xunit V2, NCrunch is directly integrated and does support this feature. Xunit V2 is currently in a beta state.

Post a reply

Log in to reply.