Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NUnit Error: Not a test assembly

I have a solution with 3 projects in it (one is a C# class-library for unit tests, another is a MVC 2 web application)

I have included all the necessary references for NUnit, and I have correctly decorated the classes and methods with [TestFixture] and [Test] respectively.

It compiles with no errors.

I am using Visual Studio 2010 Pro

When I try to open UnitTests.dll in NUnit, I get the following error:

Not a test assembly. This assembly was not built with any known testing framework.

like image 939
Didaxis Avatar asked Dec 07 '10 02:12

Didaxis


2 Answers

This may or may not be the issue that you are facing, but I had exactly the same issue and I found that the dll I was loading was an old file.

Rebuild the project and then actually go into the directory that the dll is in and check that it has a creation/modification time that is current.

It's very easy, for example, to create:

my_project/
my_project/domain/
my_project/unit-tests/ (removed but not deleted on the HD, not visible in studio)
my_project/domain/unit-tests/ (visible as MyProject.UnitTests)

If you then load the dll in my_project/unit-tests/ you may not be loading the dll you just built.

Try also file -> save as while editing a test class, and see what actual directory it is being saved into, and check that the dll you are loading is from the same path.

like image 171
Doug Avatar answered Sep 22 '22 01:09

Doug


Is there a reference to the assembly in the GAC? Take a look in tools > test assemblies of the NUnit GUI runner as per this blog posting:

http://blog.solien.com/archive/2010/02/09/unable-to-load-unit-test-the-assembly-was-not.aspx

like image 36
Pero P. Avatar answered Sep 26 '22 01:09

Pero P.