简体   繁体   English

Visual Studio 2017(企业)上的 NUnit:Test Runner 仅作为扩展工作,而不是解决方案 NuGet 包?

[英]NUnit on Visual Studio 2017 (Enterprise): Test Runner only works as Extension, not Solution NuGet package?

My problem is very similar to NUnit Unit tests not showing in Test Explorer with Test Adapter installed , in that I couldn't get the NUnit tests to appear in the Test Explorer (despite multiple rebuilds, setting the Test architecture to x64 , etc).我的问题与NUnit 单元测试未显示在安装了测试适配器的测试资源管理器中非常相似,因为我无法让 NUnit 测试出现在测试资源管理器中(尽管多次重建,将测试架构设置为 x64等)。 I rebuilt and rebuilt, and despite having NUnit 3 and the NUnit 3 Test Runner installed into my Solution (via Tools -> NuGet Package Manager -> Manage NuGet Packages For Solution...) I couldn't get the tests to appear.我重建又重建,尽管在我的解决方案中安装了 NUnit 3 和 NUnit 3 测试运行器(通过工具 -> NuGet 包管理器 -> 管理解决方案的 NuGet 包...),我无法让测试出现。

On the advice of another response to the above question, I installed the NUnit 3 Test Runner as an Extension (which modified all of Visual Studio, not just my project).根据对上述问题的另一个回答的建议,我安装了 NUnit 3 Test Runner 作为扩展(它修改了所有 Visual Studio,而不仅仅是我的项目)。

After the extension is installed (and I do Yet Another Rebuild :) ) all my tests are listed in the Test Explorer.安装扩展后(我做了 Yet Another Rebuild :))我的所有测试都列在测试资源管理器中。

Question: Why do are the tests shown in the Test Explorer for the Visual Studio-wide NUnit 3 Test Runner Extension, but NOT in the Solution-specific NUnit 3 Test Runner NuGet package?问题:为什么测试资源管理器中显示了 Visual Studio 范围的 NUnit 3 测试运行器扩展中的测试,而不是特定于解决方案的 NUnit 3 测试运行器 NuGet 包中的测试?

What's even weirder is that the exact same project, with the per-Solution NuGet packages for NUnit, work just fine on my personal computer (WITHOUT the NUnit Extensions installed), using Visual Studio 2017 Community edition.更奇怪的是,使用 Visual Studio 2017 社区版的完全相同的项目,使用 NUnit 的每个解决方案 NuGet 包,在我的个人计算机上运行得很好(没有安装 NUnit 扩展)。 It's only when I .ZIP the project and email it to another computer (which runs Visual Studio 2017 Enterprise) where I have this problem.只有当我 .ZIP 项目并将其通过电子邮件发送到另一台计算机(运行 Visual Studio 2017 Enterprise)时,我才会遇到此问题。

I'd prefer to install NUnit into the solution so that I can hand out copies to my students and have the project be completely self-contained.我更愿意将 NUnit 安装到解决方案中,以便我可以将副本分发给我的学生并使项目完全独立。

Does anyone have any advice on how to further dig into the problem with the per-Solution NuGet package?有没有人对如何进一步挖掘每个解决方案 NuGet 包的问题有任何建议? I'm kinda stymied since the only obvious thing to try is "rebuild it again and see if that helps" :), so any thoughts on stuff to try / strategies to use would be great.我有点受阻,因为唯一明显的尝试是“重新构建它,看看是否有帮助”:),所以任何关于尝试/使用策略的想法都会很棒。

At this point it looks like the Virtual Machine that I'm running the tests in thinks that the project is being run from a network drive.在这一点上,我运行测试的虚拟机似乎认为该项目是从网络驱动器运行的。 .Net has different rules for running code remotely and by default doesn't want to execute remote code (which seems reasonable :) ). .Net 对远程运行代码有不同的规则,默认情况下不想执行远程代码(这似乎是合理的 :))。

It's worth pointing out that NUnit should (and does!) work just fine in a VM where the project is saved onto a virtual disk - it's just the 'network drive'/file share that's causing the problem.值得指出的是,NUnit 应该(并且确实!)在项目保存在虚拟磁盘上的 VM 中工作得很好——这只是导致问题的“网络驱动器”/文件共享。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio Professional 2017中的Nuget程序包 - Nuget Package in Visual Studio Professional 2017 Visual Studio 2017企业添加单元测试项目引发程序包安装错误 - Visual Studio 2017 Enterprise Add Unit Test project throws Package Installation Error 无法识别解决方案文件夹中的Visual Studio 2017 Nuget.config - Visual Studio 2017 Nuget.config at solution folder not recognized Visual Studio 2017 + NUnit + Resharper中的配置文件单元测试 - Profile unit test in Visual Studio 2017 + NUnit + Resharper 增加Nuget包版本NetStandard本地文件夹视觉工作室2017 - Increment Nuget Package Version NetStandard Local Folder visual studio 2017 在Visual Studio Test Runner中从外部测试套件程序集运行NUnit测试 - Running NUnit tests from external test suite assembly in Visual Studio Test Runner 是否有任何 NuGet API 可以从 Visual Studio 扩展项目创建包 - Is there any NuGet API to create a Package from a Visual Studio Extension project 是从Visual Studio还是从命令行运行程序调用了测试(NUnit3)? - Was a test (NUnit3) invoked from Visual Studio or from a command line runner? 单元测试,NUnit或Visual studio? - Unit test, NUnit or Visual studio? 如何在Visual Studio 2015上使用NuGet Package Manager安装NUnit for C# - How to install NUnit for C# with NuGet Package Manager on Visual Studio 2015
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM