Failed to load the application or run the "Microsoft.Dnx.TestHost" command. Available commands: test

Trying to test an ASPNET 5 application in VS2015.

{ "version": "1.0.0-*", "description": "HoldingTank Class Library", "dependencies": { "EntityFramework.InMemory": "7.0.0-rc1-final", "FluentAssertions": "4.1.1", "GenFu": "1.0.4", "MyMVCProject": "1.0.0-*", "xunit": "2.1.0", "xunit.runner.visualstudio": "2.1.0" }, "commands": { "test": "xunit.runner.dnx" }, "frameworks": { "dnx451": { } } } 

However, the tests do not appear in the Test Explorer window, and when I press F5, I get:

 ------ Discover test started ------ ------ Test started: Project: HoldingTank ------ Starting Microsoft.Dnx.TestHost [C:\Users\erik\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnx.exe --appbase "C:\code\PortalSolution\src\HoldingTank" Microsoft.Dnx.ApplicationHost --port 52620 Microsoft.Dnx.TestHost --port 56351 --parentProcessId 8368] Error: Unable to load application or execute command 'Microsoft.Dnx.TestHost'. Available commands: test. Unable to start Microsoft.Dnx.TestHost ========== Discover test finished: 0 found (0:00:01.8238001) ========== 

I have only one test, decorated with [Fact], but it does not seem to get to this.

Considering similar questions that cannot "load" errors (but could not find any specific for TestHost), I tried to make sure that both the test project and the application are aimed at the same structures, but cannot find any discrepancies. And I don’t see anything in the event log.

Any suggestions? - I’m not even sure where to go to start eliminating this.

+5
source share
1 answer

You should add "xunit.runner.dnx" as a dependency, not "xunit.runner.visualstudio". Then it will work in VisualStudio.

Since ASP.Net 5 is in beta, i.e. xunit.runner.dnx. Use the current preview release that matches ASP.Net RC1 ... I am currently using 2.1.0-rc1-build204 with ASP.Net 5 RC1

+1
source

Source: https://habr.com/ru/post/1239173/


All Articles