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

Notification

Icon
Error

Unit test project with only xUnit.net theories in it is not picked up
DanHil
#1 Posted : Wednesday, June 5, 2013 3:23:24 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/12/2012(UTC)
Posts: 85

Thanks: 11 times
Was thanked: 3 time(s) in 3 post(s)
I have a unit test project that references both xUnit.net and xUnit.net Extensions.
The latter defines the TheoryAttribute which can be used to create data driven tests.

Now, my project doesn't contain a single [Fact] test, it only contains [Theory] tests. Additionally, it doesn't contain a single Assert from xUnit.net, so that the project in fact doesn't use xunit.dll directly but only xunit.extensions.dll.

This leads to the scenario that NCrunch doesn't pick up the tests in this project.

If I add a single line of code that directly uses xunit.dll anywhere in the project, NCrunch starts picking up all the tests again.
Remco
#2 Posted : Wednesday, June 5, 2013 11:08:51 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,982

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Daniel -

This is a limitation inherent in the Gallio adapter NCrunch is using to find the Xunit tests. The adapter only fully activates if there is a reference somewhere to xunit.dll.

You may be able to work around this problem by changing the 'Framework utilisation type for Xunit' in your solution-level configuration, although this can also have performance implications. My recommendation is to simply include a reference somewhere in your code (perhaps a dummy test) to the Xunit framework so that the adapter can activate. There are future plans to re-integrate with Xunit around its v2 release, which should eventually solve this problem.
aboy021
#3 Posted : Thursday, June 6, 2013 10:24:24 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/24/2013(UTC)
Posts: 19
Location: New Zealand

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
I've had this issue as well, and ended up using a dummy [Fact] to make sure all the [Theory] tests run.
Jonh04
#4 Posted : Friday, February 28, 2014 3:27:39 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/13/2012(UTC)
Posts: 20

Thanks: 1 times
Was thanked: 3 time(s) in 2 post(s)
Just hit it now. What does the progress look like?
Remco
#5 Posted : Friday, February 28, 2014 11:23:20 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,982

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Sorry, no fix is currently available for this issue. The current long term plan is to replace the current xUnit integration (which works through Gallio) with direct integration with xUnit. This will also include support for xUnit v2.
mmisztal
#6 Posted : Sunday, May 10, 2015 8:41:28 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hello,

I'm attempting to run xUnit 2.0.0 tests using NCrunch from VS 2015 RC.

Has the issue been resolved? NCrunch still doesn't appear to be picking up any tests.
Remco
#7 Posted : Sunday, May 10, 2015 9:11:33 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,982

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi,

As far as I am aware, this issue is resolved. If you're seeing this in the latest version of NCrunch, can you share any sample code?
mmisztal
#8 Posted : Monday, May 11, 2015 7:49:16 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Considering that this is basic code - I'm a bit puzzled - NCrunch is not picking this up.
I'm using NCrunch for Visual Studio 2015 2.15.0.9

Quote:
using Xunit;
using Assert = Xunit.Assert;

namespace My.Tests
{
// This project can output the Class library as a NuGet Package.
// To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build".
public class ConditionTests
{
[Fact]
public void X()
{
Assert.True(true);
}
}
}


Here's my project.json file :

Quote:
{
"version": "1.0.0-*",
"description": "",
"authors": [ "" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",

"dependencies": {
"System.Runtime": "4.0.20-beta-22907",
},

"frameworks": {
"dnx451": {
"dependencies": {
"xunit": "2.0.0"
}
},
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.10-beta-22816",
"System.Linq": "4.0.0-beta-22816",
"System.Threading": "4.0.10-beta-22816",
"Microsoft.CSharp": "4.0.0-beta-22816",
"xunit": "2.0.0"
}
}
}
}
Remco
#9 Posted : Monday, May 11, 2015 9:17:05 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,982

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Right - here's the issue: NCrunch doesn't support the JSON based project files yet.

This area is still a work in progress. Likely it will be out before VS2015 is fully released.
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.070 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download