问题描述
不确定这是否是正确的论坛,但是在C#项目上运行单元测试时,我很难获得CodeCoverage报告.
Not sure if this is the correct forum, but I'm having difficulty getting CodeCoverage reports when running my Unit tests on my C# projects.
我设置了一个Jenkins服务器,该服务器正在使用MSBuild构建我的项目,同时对它运行StyleCop和fxCop并很好地报告所有情况.我还安装了xUnit并使其正常工作.我现在正在尝试将OpenCover添加到组合中,但我无法确定 找出我要去的地方或解决方法!
I have a Jenkins server set up, which is building my project with MSBuild, running both StyleCop and fxCop against it and reporting it all nicely. I have also installed xUnit and got that to work. I am now trying to add OpenCover to the mix and I can't figure out where I'm going wrong, or how to fix it!
我正在运行的命令行归结为:
The command line I'm running boils down to:
" C:\ Program Files(x86)\ Jenkins \ workspace \ JenkinsSandbox \ packages \ OpenCover.4.6.519 \ tools \ OpenCover.Console.exe -register:path64 -target:"C:\ Program Files(x86)\ Jenkins \ workspace \ JenkinsSandbox \ xunit \ xunit.console.exe" " -targetargs: \"C:\ Program Files(x86)\ Jenkins \ workspace \ JenkinsSandbox \ JenkinsSandbox.Tests \ bin \ Debug \ JenkinsSandbox.Tests.dll \" -xml \"C:\ Program Files(x86)\ Jenkins \ workspace \ JenkinsSandbox \ xunit-results.xml \" -all all" -输出:" C:\ Program 文件(x86)\ Jenkins \ workspace \ JenkinsSandbox \ JenkinsSandbox.Tests \ bin \ Debug \ JenkinsSandbox.coberturacoverage' -coverbytest:*.Tests.dll -targetdir:"C:\ Program Files(x86)\ Jenkins \ workspace \ JenkinsSandbox \ JenkinsSandbox.Tests \ bin \ Debug" -hideskipped:过滤器
"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe" -register:path64 -target:"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\xunit\xunit.console.exe" "-targetargs: \"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\JenkinsSandbox.Tests\bin\Debug\JenkinsSandbox.Tests.dll\" -xml \"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\xunit-results.xml\" -parallel all" -output:"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\JenkinsSandbox.Tests\bin\Debug\JenkinsSandbox.coberturacoverage" -coverbytest:*.Tests.dll -targetdir:"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\JenkinsSandbox.Tests\bin\Debug" -hideskipped:Filter
运行单元测试,然后在控制台中看到此信息...
The Unit tests run, then in the console I see this...
=== TEST EXECUTION SUMMARY ===
JenkinsSandbox.Tests Total: 3, Errors: 0, Failed: 0, Skipped: 0, Time: 2.969s
Committing...
An System.IO.DirectoryNotFoundException occured: Could not find a part of the path 'C:\BuildAgent\work\cb37e9acf085d108\src\common\AssemblyExtensions.cs'.
An System.IO.DirectoryNotFoundException occured: Could not find a part of the path 'C:\BuildAgent\work\cb37e9acf085d108\src\common\DictionaryExtensions.cs'.
推荐答案
保罗,
根据您的描述,您在项目中使用的是Jenkins,建议您最好将问题发布到以下链接中以获得专业的答案.
https://jenkins.io/
请单击邮件列表:
此致
奥斯卡
这篇关于使用OpenCover和xUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!