2015-12-25 57 views
5

嘗試在VS2015中測試ASPNET 5應用程序。無法加載應用程序或執行命令'Microsoft.Dnx.TestHost'。可用命令:test

{ 
    "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": { } 
    } 
} 

然而,沒有測試在測試瀏覽器窗口中顯示出來,當我按下F5我得到:

------ 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) ========== 

我只是有一個測試,飾以[事實],但它不看就像它正在那麼遠。

看着類似的問題,「無法加載」的錯誤(但找不到任何特定的TestHost),我試圖確保測試項目和應用程序目標相同的框架,但不能' t找到任何差異。我沒有看到事件日誌中的任何內容。

有什麼建議嗎? - 甚至不知道該從哪裏開始排除故障。

回答

1

您必須添加「xunit.runner.dnx」作爲依賴項而不是「xunit.runner.visualstudio」。然後它將在VisualStudio中工作。

由於ASP.Net 5處於測試階段,因此xunit.runner.dnx也是如此。使用目前與ASP.Net RC1相匹配的預發佈...我目前使用2.1.0-rc1-build204與ASP.Net 5 RC1

相關問題