【问题标题】:NUnit VS Adapter do not discover tests due to FileNotFoundException, Exception converting tests由于 FileNotFoundException,NUnit VS Adapter 未发现测试,异常转换测试
【发布时间】:2018-07-22 12:27:50
【问题描述】:

尝试通过 Visual Studio 测试资源管理器运行测试时,解决方案中的所有测试(使用 Typemock 和不使用 Typemock 的测试)都出现以下错误:

[2/12/2018 11:35:36 AM Informational] NUnit VS Adapter 2.1.1.0 发现测试已启动 [2/12/2018 11:35:37 AM 错误] 异常 System.IO.FileNotFoundException,异常转换 Manager.Tests.MessageLoggerTest.AddMessage_WhenAddMessageIsCalled_ThenAddMessagesToList ...

我在 Xamarin 论坛上仅在线发现一处提到该问题,但没有修复 (https://forums.xamarin.com/discussion/119513/xamarin-ui-tests-filenotfoundexception)。

我使用Visual Studio Enterprise 2017, version 15.5.6NUnit 2.6.4NUnitTestAdapter 2.1.1Typemock 8.6.0.22

通过 Typemock runner (Test Navigator) 运行测试按预期工作。

编辑

我觉得有点尴尬,我无法重现我原来的错误。在工作中,我们使用代码库的多个分支。现在,一个分支工作正常。我可以通过 VS runner (Test Explorer) 发现和运行测试。

在另一个分支上,重建 1. 测试项目时,我得到的是 StackOverflowException 而不是 FileNotFoundException。但它也发现了项目中的 43 个测试中的 41 个。 2. 测试项目也得到StackOverflowException 并且没有发现295个测试。

[2/20/2018 10:43:40 AM 信息] ------ 发现测试开始 ------ [2/20/2018 10:43:44 AM 信息] NUnit VS Adapter 2.1.1.0 发现测试已启动 [2/20/2018 10:43:54 AM 错误] 活动测试发现已中止。原因:由于 StackOverflowException 导致进程终止。

[2/20/2018 10:43:54 AM 信息] ========== 发现测试已完成:找到 41 个 (0:00:13.8969695) ==========

比较了solution 文件、project 文件和NuGet 包配置。分支之间的唯一区别是packages.config 行:

<package id="Typemock.Isolator" version="8.6.0.18" targetFramework="net452" />

工作分支有targetFramework="net452",失败分支有targetFramework="net462"。然而,将框架更改为 net452 并没有帮助。

必须深入挖掘才能看到不同之处。感谢任何人的帮助和时间。

【问题讨论】:

  • 你能为此上传一个小型复制项目吗?

标签: visual-studio unit-testing nunit mstest typemock


【解决方案1】:

尝试从库中安装适用于 Visual Studio 的 NUnit 2 测试适配器扩展。这解决了我在一个项目中也使用 NUnit 2.6.4 的问题。

【讨论】:

    【解决方案2】:

    我也遇到过同样的问题。 在我的情况下,删除 Windows 中的临时文件解决了我的问题。

    关闭视觉工作室。转到运行并键入 %temp%。清除所有文件。现在的视觉工作室 将发现所有 UI 测试用例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-14
      • 2013-03-16
      • 2011-11-14
      • 1970-01-01
      • 2019-11-11
      • 1970-01-01
      • 2011-07-31
      相关资源
      最近更新 更多