单元测试不运行

编程入门 行业动态 更新时间:2024-10-23 15:34:16
本文介绍了单元测试不运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我右键单击单元测试并单击调试测试,我会收到一条消息,显示"构建成功"。就是这样。

我曾经在控制台中收到一条消息,说明发现了"0测试"的结果。但现在我甚至都没有。

Visual Studio版本是:15.0.0-RC.4 + 26206.0

我见过: github/nunit/dotnet- test-nunit / issues / 99

< Project Sdk =" Microsoft.NET.Sdk" ;> < PropertyGroup> < TargetFrameworks> netcoreapp1.1< / TargetFrameworks> < / PropertyGroup> < ItemGroup> < PackageReference Include =" dotnet-test-nunit"版本= QUOT; 3.4.0-β-3英寸/> < PackageReference Include =" LeaderAnalytics.AdaptiveClient"版本= QUOT; 1.7.0" /> < PackageReference Include =" Microsoft.DotNet.InternalAbstractions"版本= QUOT; 1.0.0" /> < PackageReference Include =" NETStandard.Library"版本= QUOT; 1.6.1" /> < PackageReference Include =" Newtonsoft.Json"版本= QUOT; 9.0.1" /> < PackageReference Include =" NUnit"版本= QUOT; 3.6.0" /> < PackageReference Include =" Moq"版本= QUOT; 38年6月4日-α" /> < PackageReference Include =" Autofac"版本= QUOT; 4.2.1" /> < PackageReference Include =" NUnit3TestAdapter"版本= QUOT; 3.7.0" /> < / ItemGroup> < / Project>

解决方案

你好,

不是肯定这会解决你的问题,但值得尝试。复制单元测试,将其剪切到剪贴板。构建解决方案。重新放入单元测试,从Solution Explorer构建解决方案。现在尝试再次运行测试。

您应该可以通过CodeLens运行测试,例如但这可能取决于您拥有的Visual Studio版本。

If I right click in a unit test and click debug tests I get a message that says "Build succeeded". And that's it.

I used to get a message in the console that says something to the effect of "0 tests discovered" but now I don't even get that.

Visual studio version is: 15.0.0-RC.4+26206.0

I've seen: github/nunit/dotnet-test-nunit/issues/99

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netcoreapp1.1</TargetFrameworks> </PropertyGroup> <ItemGroup> <PackageReference Include="dotnet-test-nunit" Version="3.4.0-beta-3" /> <PackageReference Include="LeaderAnalytics.AdaptiveClient" Version="1.7.0" /> <PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" /> <PackageReference Include="NETStandard.Library" Version="1.6.1" /> <PackageReference Include="Newtonsoft.Json" Version="9.0.1" /> <PackageReference Include="NUnit" Version="3.6.0" /> <PackageReference Include="Moq" Version="4.6.38-alpha" /> <PackageReference Include="Autofac" Version="4.2.1" /> <PackageReference Include="NUnit3TestAdapter" Version="3.7.0" /> </ItemGroup> </Project>

解决方案

Hello,

Not positive this will solve your issue but worth trying. Copy the unit test, cut it to the clipboard. Build the solution. Drop the unit test back in, build the solution from Solution Explorer. Now try running the test again.

You should be able to run the test via CodeLens e.g. but that may be dependent on the edition of Visual Studio you have.

更多推荐

单元测试不运行

本文发布于:2023-10-31 04:12:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544966.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元测试

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!