问题描述
我正在将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)
- 添加
dotnet restore
任务. - 然后执行
dotnet build
任务. - 添加带有参数
--no-build --logger "trx;LogFileName=tests-log.trx
的 - 添加具有以下设置的
Publish test results
任务
dotnet test
任务- Add a
dotnet restore
task. - Then a
dotnet build
task. - Add a
dotnet test
task with the arguments--no-build --logger "trx;LogFileName=tests-log.trx
- Add a
Publish test results
task with the following settings
-
Test Result Format
= VSTest -
Test Result Files
= **/tests-log.trx -
Merge Test Results
=(已选中) - 在
Control Options
中将Run this task
设置为即使先前的任务失败也可以运行
Test Result Format
= VSTestTest Result Files
= **/tests-log.trxMerge Test Results
= (checked)- In
Control Options
setRun this task
to run even if a previous task has failed
这篇关于在VSTS中在.NET Core 1.1上进行Dotnet测试:未注册测试发现程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!