Tim Huffam

Dotting the I and crossing the T of I.T.

  Home  |   Contact  |   Syndication    |   Login
  153 Posts | 0 Stories | 2747 Comments | 653 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

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

Feedback

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

Post A Comment
Title:
Name:
Email:
Comment:
Verification: