简体   繁体   English

跳过xUnit测试

[英]xUnit Tests skipped

In my VS2017 solution I have several unit test projects. 在我的VS2017解决方案中,我有几个单元测试项目。 In on of them my xUnit tests do not get discovered by mstest and therefore are not run. 在他们看来,我的xUnit测试不会被mstest发现,因此不会运行。

I do get the warning: 我收到了警告:

Warning: [xUnit.net 00:00:00.7641189] Skipping: Testing.UnitTests (could not find dependent assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0') 警告:[xUnit.net 00:00:00.7641189]跳过:Testing.UnitTests(找不到依赖程序集'Microsoft.VisualStudio.QualityTools.UnitTestFramework,Version = 10.0.0')

But Microsoft.VisualStudio.QualityTools.UnitTestFramework is referenced in the project in exactly that version. Microsoft.VisualStudio.QualityTools.UnitTestFramework在项目中完全引用该版本。 I have multiple unit testing projects. 我有多个单元测试项目。 Many of them contain xUnit tests as well, but they get found and executed without any problems. 它们中的许多都包含xUnit测试,但它们可以毫无问题地被找到并执行。

All projects containing xUnit tests have the same xUnit nuget packages assigned, especially xunit.runner.visualstudio 包含xUnit测试的所有项目都分配了相同的xUnit nuget包,尤其是xunit.runner.visualstudio

I am also using NCrunch and NCrunch has no problem discovering and execution the xUnit tests in question. 我也在使用NCrunch和NCrunch在发现和执行有问题的xUnit测试时没有问题。

What could possibly be the reason to my problems? 可能是我的问题的原因是什么?

Further Findings: 进一步的发现:

  • After upgrading Microsoft.VisualStudio.QualityTools.UnitTestingFramework to version 10.1.0.0, the xUnit tests were found but then I suddenly had 438 from 2447 failing. Microsoft.VisualStudio.QualityTools.UnitTestingFramework升级到版本10.1.0.0后,找到了xUnit测试,但后来我突然从2447失败了438。 Those failing tests -mostly not xUnit - were previously working fine. 那些失败的测试 - 通常不是xUnit - 以前工作正常。
  • After shutting down an restarting visual studio the UnitTeestingFramework was automatically reset to version 10.0.0 关闭重新启动的Visual Studio后,UnitTeestingFramework自动重置为10.0.0版
  • opening the Reference Manager (Add References) all the project references are shown by selected checkboxes except of Microsoft.VisualStudio.QualityTools.UnitTestingFramework which only shows up if I previously add eg "Quality" to the search box, but then I see Microsoft.VisualStudio.QualityTools.UnitTestingFramework three times. 打开引用管理器(添加引用)所有项目引用都显示为选中的复选框, Microsoft.VisualStudio.QualityTools.UnitTestingFramework除外,它只显示我之前添加例如“质量”到​​搜索框,但后来我看到Microsoft.VisualStudio .QualityTools.UnitTestingFramework三次。 One checked (version 10.0.0.0) an other one with same version, but different path and one with version 10.1.0.0 一个已检查(版本10.0.0.0)另一个具有相同版本但路径不同且版本为10.1.0.0的版本

All together looks quite odd to me... 对我来说,一起看起来很奇怪......

I had this issue but am not sure if this is exactly the same as yours. 我有这个问题,但不确定这是否和你的完全相同。 I saw an error in the output/tests window which stated it couldn't restore package xunit.runner.utility 2.2.0 我在输出/测试窗口中看到一个错误,表示它无法恢复包xunit.runner.utility 2.2.0

After manually adding this in in package manager console like so: 在包管理器控制台中手动添加后,如下所示:

install-package xunit.runner.utility -v 2.2.0

It started working again 它又开始工作了

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

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