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

Notification

Icon
Error

Xunit tests won't runwhen you have them in a nested class
chrissie1
#1 Posted : Saturday, March 16, 2013 7:37:16 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/16/2013(UTC)
Posts: 1
Location: Belgium

Thanks: 1 times
For an example go to the test branch of scriptcs on github. https://github.com/scriptcs/scriptcs/tree/dev/src

They do this.

Code:
public class FileProcessorTests
    {
        public class ProcessFileMethod
        {
            private List<string> _file1 = new List<string>
                {


NCrunch does not find any tests. But when I remove the outer class (FileProcessorTests) the tests start to run.

Is there any setting I am missing to resolve this?
Remco
#2 Posted : Saturday, March 16, 2013 10:39:13 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, thanks for posting!

This issue is caused by a limitation in the Gallio adapter NCrunch is using to discover Xunit tests. Basically, the adapter doesn't search nested Xunit classes for tests when using Static Analysis. A workaround is to set the 'Framework utilisation type for Gallio/Xunit' solution-level configuration option to 'DynamicAnalysis'.

I'm currently looking for ways to properly solve this problem. It only affects Xunit (not the other frameworks supported by NCrunch).

Cheers,

Remco
1 user thanked Remco for this useful post.
chrissie1 on 3/17/2013(UTC)
Remco
#3 Posted : Saturday, March 30, 2013 9:40:28 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)
For anyone interested, a fix for this problem has been introduced with the newly released version of NCrunch (v1.45), so it's now possible for NCrunch to discover nested Xunit tests using static analysis.
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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download