VSTS 中 .NET Core 1.1 上的 Dotnet 测试:未注册测试发现者 [英] Dotnet test on .NET Core 1.1 in VSTS: No Test Discoverer is Registered

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

问题描述

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

没有注册测试发现者来执行测试用例的发现.

如何在 VSTS 中注册此发现者并运行我的测试?

解决方案

这是我在 VSTS 上的构建过程 (

  1. 测试结果格式 = VSTest
  2. 测试结果文件 = **/tests-log.trx
  3. 合并测试结果 =(选中)
  4. Control Options 中设置 Run this task 即使上一个任务失败也运行

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.

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

解决方案

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

  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 = (checked)
  4. In Control Options set Run this task to run even if a previous task has failed

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆