Unable to load <mytest> because it is not located under Appbase

こ雲淡風輕ζ 提交于 2019-12-08 16:39:30

问题


I have created an 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

What is it related to? I have also checked my configuration file. I am running this from console.

Update:

I want to start NUnit, and then it should load my Visual Studio project that is in some directory and then run all the tests (if I don't define it in any NUnit project).

Actually I want to create a batch file to run all this. When I do this it won't load the project. I have defined the c:\Program Files\nunit\bin path in the environment variable.


回答1:


You must fill in the ApplicationBase by yourself in some cases. Main menu, Project, Edit, fill ApplicationBase where the DLL file is.




回答2:


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.




回答3:


If running under VISTA, you must be an Admin.




回答4:


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.



来源:https://stackoverflow.com/questions/424798/unable-to-load-mytest-because-it-is-not-located-under-appbase

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!