在VSTS中的.NET Core 1.1上进行Dotnet测试:没有注册测试发现者

时间:2017-04-20 19:42:38

标签: azure-devops .net-core mstest vstest dotnet-cli

我正在使用VS 2017与.NET标准类库中的新csproj,尝试使用带有dotnet test命令的MSTest测试框架,使用.NET Core 1.1测试项目来测试库。在当地跑步完美无缺;当我将构建发送到持续集成时,我收到错误:

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

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

2 个答案:

答案 0 :(得分:5)

这是我在VSTS(detailed on my blog here

上的构建过程
  1. 添加dotnet restore任务。
  2. 然后是dotnet build任务。
  3. 使用参数dotnet test
  4. 添加--no-build --logger "trx;LogFileName=tests-log.trx任务
  5. 使用以下设置添加Publish test results任务
  6. enter image description here

    1. Test Result Format = VSTest
    2. Test Result Files = ** / tests-log.trx
    3. Merge Test Results =(已选中)
    4. Control Options设置Run this task即使上一个任务失败也要运行

答案 1 :(得分:0)

请参阅以下步骤:

  1. 使用MSTest测试框架创建一个新的.Net Core测试项目,有MSTest.TestAdapter和MSTest.TestFramework包参考,这很重要
  2. 添加.NET Core(预览)步骤(命令:恢复)
  3. 添加.NET Core(预览)步骤(命令:构建)
  4. 添加.NET Core(预览)步骤(命令:test)
  5. 使用托管VS2017 构建代理构建队列。
相关问题