VSTS 中 .NET Core 1.1 上的 Dotnet 测试:未注册测试发现者
Dotnet test on .NET Core 1.1 in VSTS: No Test Discoverer is Registered
我在 .NET Standard class 库中使用 VS 2017 和新的 csproj,尝试使用 MSTest 测试框架和 dotnet test
命令。 运行 在本地工作得很好;当我将构建发送到持续集成时,出现错误:
No test discoverer is registered to perform discovery of test cases.
如何在 VSTS 中注册此发现者和我的测试 运行?
参考以下步骤:
- 用MSTest测试框架新建.Net Core测试项目,有MSTest.TestAdapter和MSTest.TestFramework包引用,很重要
- 添加 .NET Core(预览版)步骤(命令:恢复)
- 添加 .NET Core(预览版)步骤(命令:构建)
- 添加 .NET Core(预览版)步骤(命令:测试)
- 使用 Hosted VS2017 构建代理排队构建。
这是我在 VSTS 上的构建过程 (detailed on my blog here)
- 添加一个
dotnet restore
任务。
- 然后是
dotnet build
任务。
- 添加参数为
--no-build --logger "trx;LogFileName=tests-log.trx
的 dotnet test
任务
- 使用以下设置添加
Publish test results
任务
Test Result Format
= VSTest
Test Result Files
= **/测试-log.trx
Merge Test Results
=(选中)
- 在
Control Options
中将 Run this task
设置为 运行 即使之前的任务失败了
我在 .NET Standard class 库中使用 VS 2017 和新的 csproj,尝试使用 MSTest 测试框架和 dotnet test
命令。 运行 在本地工作得很好;当我将构建发送到持续集成时,出现错误:
No test discoverer is registered to perform discovery of test cases.
如何在 VSTS 中注册此发现者和我的测试 运行?
参考以下步骤:
- 用MSTest测试框架新建.Net Core测试项目,有MSTest.TestAdapter和MSTest.TestFramework包引用,很重要
- 添加 .NET Core(预览版)步骤(命令:恢复)
- 添加 .NET Core(预览版)步骤(命令:构建)
- 添加 .NET Core(预览版)步骤(命令:测试)
- 使用 Hosted VS2017 构建代理排队构建。
这是我在 VSTS 上的构建过程 (detailed on my blog here)
- 添加一个
dotnet restore
任务。 - 然后是
dotnet build
任务。 - 添加参数为
--no-build --logger "trx;LogFileName=tests-log.trx
的 - 使用以下设置添加
Publish test results
任务
dotnet test
任务
Test Result Format
= VSTestTest Result Files
= **/测试-log.trxMerge Test Results
=(选中)- 在
Control Options
中将Run this task
设置为 运行 即使之前的任务失败了