Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch ignores xUnit Theory if it is the only test in a file
SeanKilleen
#1 Posted : Wednesday, May 21, 2014 3:46:27 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/21/2014(UTC)
Posts: 7
Location: United States of America

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I think I've narrowed it down to the following behavior:


  • Test class with one xUnit Fact -- NCrunch does not ignore the fact and runs it
  • Test class with one xUnit Theory -- NCrunch ignores the theory and states there are no tests to run
  • Tesr class with a dummy xUnit Fact (e.g. true = true) and a Theory -- NCrunch no longer ignores the theory and runs it as I expect.


Is this a bug, or is it a setting somewhere? Sometimes when testing something, you need a theory and only a theory. Interested to know if others have had this same issue.

Thanks,
Sean
Remco
#2 Posted : Wednesday, May 21, 2014 9:36:15 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Sean,

Can you share the declaration of your theory?

In order for NCrunch to detect that Xunit is being used by a test project, there must be a reference to at least one Xunit attribute. If you are using attributes that descend from the Xunit attributes and are not declared inside xunit.dll, this means you'll need to have somewhere a dummy '[Fact]' test to ensure the reference to Xunit can be identified.
SeanKilleen
#3 Posted : Wednesday, May 21, 2014 10:25:55 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/21/2014(UTC)
Posts: 7
Location: United States of America

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Remco;5921 wrote:
If you are using attributes that descend from the Xunit attributes and are not declared inside xunit.dll, this means you'll need to have somewhere a dummy '[Fact]' test to ensure the reference to Xunit can be identified.



This makes sense, because [Theory] is declared in xunit.extensions which I presume is a separate DLL because it's a separate Nuget package.

Could I please suggest that NCrunch consider expanding their search for attributes to within xunit and xunit.extensions? This would solve the problem, and broaden support for xunit since I belive xunit.extensions is an official xunit project.
Remco
#4 Posted : Wednesday, May 21, 2014 11:04:54 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
SeanKilleen;5922 wrote:
e [Theory] is declared in xunit.extensions which I presume is a separate DLL because it's a separate Nuget package.

Could I please suggest that NCrunch consider expanding their search for attributes to within xunit and xunit.extensions? This would solve the problem, and broaden support for xunit since I belive xunit.extensions is an official xunit project.


Sadly this is outside of NCrunch's control at the moment, as all interaction with Xunit goes via Gallio. This is something that is being fixed with the launch of Xunit V2, which will introduce NCrunch integration directly into Xunit.
1 user thanked Remco for this useful post.
SeanKilleen on 5/22/2014(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.038 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download