The other day I wanted to learn something new so I decided to try a little Unit Testing using Microsoft .NET. After looking at different Unit Testing Frameworks I chose to use NUnit Framework. I then tried an example found on the web and after the project was built, I loaded NUnit GUI and opened unit test assembly, but to my surprise, the NUnit GUI was giving me Error message. It was telling me that the Test load failed with detailed error: SystemApplicationException: Unable to find test in the assembly.
In the end I found three different ways to make NUnit work and each one will be shown in this article.
NUnit GUI was giving me this error popup window:

- Windows 7 Professional 64 bit
- Visual Studio Express 2012 for Windows Desktop
- NUnit 2.6.2
So to make NUnit stop showing that annoying error message, try one of the fixes below:
-
Set your unit test project to target .NET 3.5 Framework or less
This problem seems to occur only when your unit test project is targeting .NET 4.0 / .NET 4.5 Framework. If the project can be made in .NET 3.5 or less, you could choose this solution. You set the target Framework by right-clicking your project then choose Properties. Under Application you have an option for Target Framework.
-
Edit nunit.exe.config file
If changing target Framework is not an option, you can modify
nunit.exe.config
file located in NUnit installation folder and add supportedRuntime element inside startup tag like this:<startup useLegacyV2RuntimeActivationPolicy="true"> <!-- Comment out the next line to force use of .NET 4.0 --> <supportedRuntime version="v4.0.30319" /> </startup>
Note:With my configuration NUnit folder is located at:C:\Program Files (x86)\NUnit 2.6.2\bin
. Since you are modifying file inProgram Files (x86)
folder, you must run your text editor as Administrator, otherwise you will not be able to save the changes. -
make Firewall unblock nunit-agent.exe from accessing localhost
When NUnit runs tests in a separate process it uses
nunit-agent.exe
program. This happens when the program needs to be run under a different framework or version from the one being used by NUnit itself. My Firewall had silently blockednunit-agent.exe
which was trying to connect to the 127.0.0.1. Once it was able to connect, the NUnit was able to find the assembly without any problems.
Ulysses Alves
October 7, 2014Nice article. Thank you for sharing solutions with us for this problem.
I was also getting this error because I had not installed NUnit in my machine. Instead, I had copied the NUnit files directly to a folder.
After installing NUnit through its setup file (Nunit.msi) the error stoped occurring.