简体   繁体   English

如何使用csproj在.net核心中注册测试发现者

[英]How do I register a test discoverer in .net core with csproj

After upgrading my nunit test project using dotnet migrate to move to from json to csproj. 使用dotnet migrate升级我的nunit测试项目后,从json迁移到csproj。 I can no longer run my tests. 我不能再进行测试了。 I get a message saying: 我收到一条消息说:

No test discoverer is registered to perform discovery of test cases. 没有注册测试发现者来执行测试用例的发现。 Register a test discoverer and try again. 注册测试发现者,然后重试。

for reference here is my csproj file 这里参考的是我的csproj文件

<Project Sdk="Microsoft.NET.Sdk">

     <PropertyGroup>
         <OutputType>Exe</OutputType>
         <TargetFramework>netcoreapp1.1</TargetFramework>
     </PropertyGroup>

     <ItemGroup>
         <ProjectReference Include="../Jsonics/Jsonics.csproj" />
     </ItemGroup>

     <ItemGroup>
         <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
         <PackageReference Include="NUnit" Version="3.6.0" />
         <PackageReference Include="dotnet-test-nunit" Version="3.4.0-beta-3" />
     </ItemGroup>
</Project>

The following page tells you what to do for xunit and mstest but not for nunit: 以下页面告诉您如何为xunit和mstest做些什么,而不是为nunit做什么:

https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json-to-csproj#testrunner https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json-to-csproj#testrunner

How do I register a test discoverer? 如何注册测试发现者?

他们正在更新适配器,请参阅此推文

The current workaround is to use NUnitLite to make your tests run in a standalone exe. 当前的解决方法是使用NUnitLite使您的测试在独立的exe中运行。 You can read how to do so here . 你可以在这里阅读如何做到这一点

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

相关问题 如何在 .NET Core 5 中注册 Firebird? - How do I register Firebird in .NET Core 5? 如何在.csproj文件中使用MSBuild条件测试编译器指令? - How do I test for compiler directives with an MSBuild Condition in a .csproj file? 如何在 *.csproj 中向 .net core 项目添加规则 - How to add rules to .net core project in *.csproj 如何在.NET Core中以编程方式测试CDN完整性? - How do I programmatically test CDN integrity in .NET Core? 如何在 ASP.NET Core 中测试 https 重定向? - How do I test an https redirect in ASP.NET Core? 如何使用 csproj 多目标 .NET Core 类库? - How do you multi-target a .NET Core class library with csproj? 如何在 Azure 函数(v2、.net 核心)中注册触发器绑定? - How do I register trigger bindings in an Azure Function (v2, .net core)? 如何在ASP.NET Core中手动注册FluentValidation验证程序? - How do I manually register FluentValidation validators, in ASP.NET Core? 如何在 ASP.NET Core 中手动注册 Mediatr 处理程序? - How do I manually register Mediatr handlers, in ASP.NET Core? 如何在Visual Studio 2015中注册.NET Core 1.1 RTM的自定义项目模板? - How do I register a custom Item Template for .NET Core 1.1 RTM with Visual Studio 2015?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM