[英]How do I enable Code Coverage for .NET Standard Library (2.0) project in VSTS (CI)
Please help me - How do I enable/show code coverage result for .NET Standard library project (2.0) in VSTS (CI). 请帮助我 - 如何在VSTS(CI)中启用/显示.NET标准库项目(2.0)的代码覆盖率结果。 Have enable Test result through dotnet Test task (.NET Core 2.0 preview) and able to to see the passed Test cases.
通过dotnet测试任务 (.NET Core 2.0预览版)启用测试结果并能够查看传递的测试用例。 Next step I have added "publish result" task but it's showing the below warning during Build - No test result files matching _temp* / .trx were found .
下一步我添加了“发布结果”任务,但它在构建期间显示以下警告 - 未找到 与_temp * / .trx 匹配的测试结果文件 。 Even I have modified the .csproj file and added
<DebugType>Full</DebugType>
. 甚至我修改了.csproj文件并添加了
<DebugType>Full</DebugType>
。
Using Visual Studio 2017 Professional (version - 15.5.2) Project - .NET Standard Library (2.0) Unit Test - MSTest (inbuilt in Visual Studio) 使用Visual Studio 2017 Professional(版本 - 15.5.2)项目 - .NET标准库(2.0)单元测试 - MSTest(内置于Visual Studio中)
What tasks / how tasks should I need to add/modify in Build Definition in VSTS, so that I can see Code Coverage against Unit Testing. 在VSTS的Build Definition中我需要添加/修改哪些任务/如何执行任务,以便我可以看到针对单元测试的代码覆盖率。
Tasks for Code Coverage - TestAssemblies 代码覆盖的任务 - TestAssemblies
Now I am able to see the Code Coverage (not sure whether correct code coverage is showing or not) but the tasks - Test Assemblies ***.test*.dll is failing with the below error - Code-Coverage-Result 现在我能够看到代码覆盖率(不确定是否显示正确的代码覆盖率)但任务 - 测试程序集***。test * .dll失败并出现以下错误 - 代码覆盖率 - 结果
No test is available in .........$(BuildConfiguration)\\netcoreapp2.0\\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll. 在......... $(BuildConfiguration)\\ netcoreapp2.0 \\ Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll中没有可用的测试。 Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate and try again.
确保测试项目具有包“Microsoft.NET.Test.Sdk”的nuget引用,框架版本设置是合适的,然后重试。
Thanks. 谢谢。
Regards, Deb 问候,Deb
First, make sure you can get code coverage result through Visual Studio. 首先,确保您可以通过Visual Studio获得代码覆盖率结果。 As far as I know, Enterprise version is required (You can use Hosted VS 2017 agent).
据我所知,企业版是必需的(您可以使用Hosted VS 2017代理商)。
The Code Coverage for .Net Core Unit test project: .Net核心单元测试项目的代码覆盖范围:
<DebugType>Full</DebugType>
to PreopertyGroup <DebugType>Full</DebugType>
到PreopertyGroup Sample: 样品:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
<DebugType>Full</DebugType>
</PropertyGroup>
Secondly, you can run test through Visual Studio Test task: ( 其次,您可以通过Visual Studio Test任务运行测试:(
Path to vstest.console.exe: C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe
vstest.console.exe的路径:
C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe
Check Code coverage enabled
option 检查
Code coverage enabled
选项
Other console options: /framework:".NETCoreApp,Version=v2.0"
) 其他控制台选项:/
/framework:".NETCoreApp,Version=v2.0"
:“. /framework:".NETCoreApp,Version=v2.0"
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.