简体   繁体   English

来自 VS 2013 (Nunit v2.x) 的 C# Nunit 测试不会显示在 VS 2017 (Nunit 3.x) 的测试资源管理器中

[英]C# Nunit tests from VS 2013 (Nunit v2.x), won't show in Test Explorer in VS 2017 (Nunit 3.x)

Good Morning早上好

Note: I am new to VS and C# coding.注意:我是 VS 和 C# 编码的新手。 Learning and have the following issue.学习并有以下问题。

PROBLEM STATEMENT: C# Nunit tests from VS 2013 (Nunit v2.x), won't show in Test Explorer in VS 2017 (Nunit 3.x)问题陈述:来自 VS 2013 (Nunit v2.x) 的 C# Nunit 测试不会显示在 VS 2017 (Nunit 3.x) 的测试资源管理器中

BACKGROUND: Recently identified good scripts for our application written with VS 2013 with C# based on NUnit 2.x.背景:最近为我们的应用程序确定了良好的脚本,使用 VS 2013 和基于 NUnit 2.x 的 C#。 I have copied them into my machine with VS 2017 and Nunit v.3.10.1 and Nunit3TestAdapter v.3.10.0.我已经使用 VS 2017 和 Nunit v.3.10.1 和 Nunit3TestAdapter v.3.10.0 将它们复制到我的机器中。

Note: The Tests are running fine in another machine with VS 2013 and Nunit v2.x注意:测试在另一台装有 VS 2013 和 Nunit v2.x 的机器上运行良好

Machine and VS config: - Windows 10 pro 64 bit OS with 64 bit processor - VS 2017: Default Processor Architecure is set to X64 - At present, "Active Solution Platform" is set to X86 for build settings for my test project (Build > Configuration Manager).机器和 VS 配置: - 带有 64 位处理器的 Windows 10 专业版 64 位操作系统 - VS 2017:默认处理器架构设置为 X64 - 目前,“活动解决方案平台”设置为 X86,用于我的测试项目的构建设置(构建 >配置管理器)。 - VS Nuget Package for Nunit: v.3.10.1 - VS Nuget Package for Nunit3TestAdapter: v.3.10.0 - Nunit 的 VS Nuget 包:v.3.10.1 - Nunit3TestAdapter 的 VS Nuget 包:v.3.10.0

What i have done or tried: - The test project cs file contains [TestFixture] and [Test] in the correct places - I have tried cleaning / rebuilding the solution multiple times - I have tried restarting Visual Studio multiple times - I researched many articles here and in other venues - Can't get a straight answer yet if it is possible, or impossible or what is the solution.我做过或尝试过的事情: - 测试项目 cs 文件在正确的位置包含 [TestFixture] 和 [Test] - 我曾多次尝试清理/重建解决方案 - 我曾多次尝试重新启动 Visual Studio - 我研究了很多文章在这里和其他场所 - 如果可能,或者不可能,或者解决方案是什么,还不能得到直接的答案。

Thank you very much!非常感谢! Andrew安德鲁

Install NUnit3TestAdapter Visual Studio plugin.安装 NUnit3TestAdapter Visual Studio 插件。

In Visual studio, go to Tools -> Extensions and Updates.在 Visual Studio 中,转到工具 -> 扩展和更新。 At the dialog, choose Online from navigation pane, and in the search bar type NUnit , pick the NUnit 3 Test Adapter plugin and install it.在对话框中,从导航窗格中选择 Online,然后在搜索栏中键入NUnit ,选择 NUnit 3 测试适配器插件并安装它。 Once done, you will be required to restart Visual Studio and rebuild your test project.完成后,您将需要重新启动 Visual Studio 并重建您的测试项目。

With the help of my friend Fahad, the issue seems to be resolved with the following steps:在我朋友 Fahad 的帮助下,问题似乎可以通过以下步骤解决:

  • Unistalled Nunit3TestAdapter v.3.10.0 and Nunit3 v.3.10.0未安装的 Nunit3TestAdapter v.3.10.0 和 Nunit3 v.3.10.0

  • Manually removed all the "nunit.*" references手动删除所有“nunit.*”引用

  • Installed the following via NuGet:通过 NuGet 安装了以下内容:

    • Nunit3 v.3.10.1 and Nunit3TestAdapter v.3.10.0 Nunit3 v.3.10.1 和 Nunit3TestAdapter v.3.10.0
    • Nunit.ConsoleRunner v.3.8.0 Nunit.ConsoleRunner v.3.8.0
  • Updated VS 2017 to the version 15.7.3将 VS 2017 更新至 15.7.3 版本

So at this point I see all the Tests in the Test Explorer.所以此时我在测试资源管理器中看到了所有的测试。 I have another issue with them not running due to this (but possible it is a different issue):由于这个原因,我有另一个问题,它们没有运行(但可能是一个不同的问题):

Warnings for not able to run Tests无法运行测试的警告

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM