views:

1968

answers:

7

I have created a nunit project(NunitLoginTest.nunit) by selcting my test project in the nunit\bin directory and now I am trying to load that project but it is giving me the following error.

Unable to load Because it is not located under Appbase, could not load file or assembly "nunitLogintest" or one of its dependencies. The system cannot find the specified path

Can any one have any idea what is it related to. I also have checked my config file.

A: 

I am running this from console.

+3  A: 

When I run my NUnit tests, I don't create a XXX.nunit project file. At the console I type:

nunit-console.exe c:\myproject\bin\myproject.test.dll

In your case, you have a .nunit file that list the assemblies to test. Make sure the paths in the file are resolving correctly from where you are executing nunit-console.exe. My example has the full path to the assembly so I can run nunit-console.exe from any where.

The nunit file looks something like this:

<NUnitProject>
  <Settings activeconfig="Debug" appbase="C:\dev\Community\src\" />
  <Config name="Debug" appbase="C:\dev\Community\src" binpathtype="Auto">
    <assembly path="Profile.Test\bin\Debug\Profile.Test.dll" />
    <assembly path="Roster.Test\bin\Debug\Roster.Test.dll" />
  </Config>
  <Config name="Release" binpathtype="Auto" />
</NUnitProject>

The appbase setting indicates where to fine the assemblies to test. So the full path to the assembly is appbase + assembly path.

Should I add this code in my nunit-console.exe.config file to make it run
No need to modify any config files. The code above is what your project.nunit file looks like when you open it.
A: 

Thanks Brig, But can you help in resolving the following steps I want to start nunit and then it should load my VS project that is in some directory and then run all the tests( if i dont define it in any nunit project).

Actually I want to create a batch file to run all this. When I do this it wont load the project. I have defined the c:programfile\nunit\bin path in environment var.

then all you need is just have your batch file have the code from my answer: nunit-console.exe path\to\project\test.dll. Note that this only runs the one test.dll. If you want mulitple test project run, then you need the testproject.nunit file.
+1  A: 

Thankyou so much atlast succeeded in running it. But the problem was I was doing it by making a console application. Then I made a Class Library for the project and it runs well.

+2  A: 

If running under VISTA, you must be an Admin.

+1 because that worked for me, thanks
Edward Tanguay
+1 It did the trick for me as well combined with changing the nunit config to use .NET 4.0 runtime.
Thomas Jespersen
A: 

I had the same "Unable to load Because it is not located under Appbase" message on Vista.

The cause was me trying to save the nunit project in the nunit program directory.

I changed the location of the save to somewhere in my documents and it worked fine. I think it would have also have worked if I logged in as admin as reddy suggested.

Matt Clarke
+2  A: 

You Must Fill the ApplicationBase by your self in some case.......... MainMenu..Project..Edit,Fill ApplicationBase where the .dll is.

MagicHu