本文介绍了单元测试不运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 如果我右键单击单元测试并单击调试测试,我会收到一条消息,显示"构建成功"。 就是这样。 我曾经在控制台中收到一条消息,说明发现了"0测试"的结果。但现在我甚至都没有。 Visual Studio版本是:15.0.0-RC.4 + 26206.0 我见过: https://github.com/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.0I've seen: https://github.com/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. 这篇关于单元测试不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-07 15:10