Build/Test Issues

xUnit Collection Fixtures

Started by sqdcm on 13,857 views

To me it seems that currently Collection Fixtures are not at all supported.

Any test class that attempts to use them instantly fail with an error similar to:

Xunit.Sdk.TestClassException: The following constructor parameters did not have matching fixture data: DatabaseFixture fixture


However, running them in the xUnit Visual Studio or Console runner works just fine.

Is there some setup piece that I am missing to make these work?
Hi, can you share any sample code that can reproduce this issue?

Cheers,

Remco

Edited

The sample code from the Collection Fixtures section of the documentation doesn't even work for me with NCrunch. Copy pasting that code, and adding a useless Fact was the first thing I tried to make sure that it was failing in my main problem wasn't a syntax error on my part somewhere.

I can copy paste that example code here if you really need it, but I only added a function with Assert.Equal(1,1) in it.
Thanks, I can see this issue now. It seems to appear for me when using the framework with static analysis.

Can you check whether the 'Framework utilisation type for XUnit V2+' solution-level configuration setting is set to 'DynamicAnalysis'?

Also, can you confirm which versions of NCrunch and XUnit you are running?
It's not something I have ever changed, and it is indeed set to UseDynamicAnalysis. Now that I am aware of the option, changing it to UseStaticAnalysis actually seems to make NCrunch unable to see any of the tests, and it reports that it is monitoring no tests.

For xUnit, I am using the 2.0.0 version off NuGet. However, I have tried 2.1.0-beta and get the same issue.

NCrunch I am using 2.13.0.5.
I've just pushed out a new version of NCrunch (v2.14.0.8) which includes re-integration with the latest version of Xunit V2.

Would you be interested in giving it a try to see if it solves this problem for you? http://www.ncrunch.net/download.
It does indeed, thank you.

Post a reply

Log in to reply.