gpt4 book ai didi

unit-testing - 无法加载应用程序或执行命令 'Microsoft.Dnx.TestHost' 。可用命令 : test

转载 作者:行者123 更新时间:2023-12-02 05:07:47 25 4
gpt4 key购买 nike

尝试在 VS2015 中测试 ASPNET 5 应用程序。

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

我只有一个测试,用 [Fact] 装饰,但看起来还没有那么远。

查看具有“无法加载”错误的类似问题(但找不到任何特定于 TestHost 的问题),我尝试确保测试项目和应用程序都针对相同的框架,但无法找出任何差异。我在事件日志中没有看到任何内容。

有什么建议吗? - 甚至不知道从哪里开始解决这个问题。

最佳答案

您必须添加“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 一起使用

关于unit-testing - 无法加载应用程序或执行命令 'Microsoft.Dnx.TestHost' 。可用命令 : test,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34458978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com