VSTS 中 .NET Core 项目的代码覆盖率和测试结果
Code coverage and test results for .NET Core projects in VSTS
我们如何在 VSTS 中启用 .NET Core 项目的代码覆盖率和测试结果?
目前没有为 .NET Core 测试任务启用。
这只回答了一半(因为我不喜欢代码覆盖率)。
首先获取dotnet test
通过传递参数-l trx
输出一个包含测试结果的trx文件
然后执行发布测试结果任务。
以下是我使用的选项:
您会得到结果(P.S。这是一个非常简单的应用程序):
我猜测可以实现类似的代码覆盖方法。
您可以使用 Visual Studio 带有 /framework:".NETCoreApp,Version=v1.1" 选项的测试任务来 运行 .NET Core 测试。 (在 Visual Studio 测试任务中指定 vstest.console.exe 路径:C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\Common7\IDE\Extensions\TestPlatform)
一篇关于代码覆盖率的文章:Working with Code Coverage。
但是上传覆盖文件时出现问题:Publish VSTest: Skipping attachment as it exceeded the maximum allowed size or not available on disk.
另一方面,您可能会遇到生成空结果的问题:Running code coverage from Visual Studio 2017 always results in "Empty results generated: No binaries were instrumented.."。
总之,您可以跟踪这些问题的更新情况,待问题修复后再试。
我们如何在 VSTS 中启用 .NET Core 项目的代码覆盖率和测试结果?
目前没有为 .NET Core 测试任务启用。
这只回答了一半(因为我不喜欢代码覆盖率)。
首先获取dotnet test
通过传递参数-l trx
然后执行发布测试结果任务。
以下是我使用的选项:
您会得到结果(P.S。这是一个非常简单的应用程序):
我猜测可以实现类似的代码覆盖方法。
您可以使用 Visual Studio 带有 /framework:".NETCoreApp,Version=v1.1" 选项的测试任务来 运行 .NET Core 测试。 (在 Visual Studio 测试任务中指定 vstest.console.exe 路径:C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\Common7\IDE\Extensions\TestPlatform)
一篇关于代码覆盖率的文章:Working with Code Coverage。
但是上传覆盖文件时出现问题:Publish VSTest: Skipping attachment as it exceeded the maximum allowed size or not available on disk.
另一方面,您可能会遇到生成空结果的问题:Running code coverage from Visual Studio 2017 always results in "Empty results generated: No binaries were instrumented.."。
总之,您可以跟踪这些问题的更新情况,待问题修复后再试。