Geeks With Blogs
Tim Huffam Dotting the I and crossing the T of I.T.
When trying to run NUnit against an assembly, it loads the assembly fine, but when you run it, it cannot find any tests (even though the assembly contains many tests). 
 
Under the 'Tests Not Run' tab, if you expand the treeview, it states: "Reason: Has no TestFixtures".
 
This problem is caused when NUnit does not have adequate rights to the assembly.  In my case it was because my project was on a network drive.
 
A simple solution to this is to add a post build event in Visual Studio to copy the assembly files from the network drive onto a local drive (ie in a temp dir), then run NUnit against this temp copy.
 
1. Within VS, open the project properties.
2. Go to the Build Events tab and enter the following 'Post-build event command line':
      del /q c:\temp\nunit\*.*
      copy "$(TargetDir)*.*" c:\temp\nunit
3. Go to the 'Debug' tab and enter the following details:
      Start external program: C:\Program Files\NUnit 2.4.1\bin\nunit.exe
      Command line arguments: "c:\temp\nunit\MyProject.dll" /run
 
Now when you click run on your solution it will start NUnit, load the assembly and run the tests automatically.
Posted on Thursday, August 2, 2007 2:23 AM | Back to top


Comments on this post: NUnit not working properly - cannot find TestFixtures (Reason: Has no TestFixtures)/getting Visual Studio to automatically run NUnit

# re: NUnit not working properly - cannot find TestFixtures (Reason: Has no TestFixtures)/getting Visual Studio to automatically r
Requesting Gravatar...
That's a great solution to the partial trust issue. Thanks for putting this up. Saved me a lot of time today. :)
Left by Jay on Oct 30, 2007 1:00 PM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net | Join free