本文介绍了在VSTS中在.NET Core 1.1上进行Dotnet测试:未注册测试发现程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将VS 2017与.NET Standard类库中的新csproj一起使用,尝试使用带有dotnet test命令的MSTest测试框架通过.NET Core 1.1测试项目来测试该库.在本地运行非常好;当我将构建发送到持续集成时,出现错误:

I'm using VS 2017 with the new csproj in a .NET Standard class library, trying to test the library with a .NET Core 1.1 test project using MSTest testing framework with the dotnet test command. Running locally works perfectly fine; when I send the build to continuous integration, I get the error:

No test discoverer is registered to perform discovery of test cases.

如何在VSTS中注册此发现程序并运行测试?

How do I get this discoverer registered, and my tests running, in VSTS?

推荐答案

这是我在VSTS上的构建过程(在我的博客上详细说明此处)

This is my build process on VSTS (detailed on my blog here)

  1. 添加dotnet restore任务.
  2. 然后执行dotnet build任务.
  3. 添加带有参数--no-build --logger "trx;LogFileName=tests-log.trx
  4. dotnet test任务
  5. 添加具有以下设置的Publish test results任务
  1. Add a dotnet restore task.
  2. Then a dotnet build task.
  3. Add a dotnet test task with the arguments --no-build --logger "trx;LogFileName=tests-log.trx
  4. Add a Publish test results task with the following settings
  1. Test Result Format = VSTest
  2. Test Result Files = **/tests-log.trx
  3. Merge Test Results =(已选中)
  4. Control Options中将Run this task设置为即使先前的任务失败也可以运行
  1. Test Result Format = VSTest
  2. Test Result Files = **/tests-log.trx
  3. Merge Test Results = (checked)
  4. In Control Options set Run this task to run even if a previous task has failed

这篇关于在VSTS中在.NET Core 1.1上进行Dotnet测试:未注册测试发现程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 10:53