Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Visual Studio 2017是否有开放式封面工具或扩展?_C#_Visual Studio_Report_Code Coverage_Opencover - Fatal编程技术网

C# Visual Studio 2017是否有开放式封面工具或扩展?

C# Visual Studio 2017是否有开放式封面工具或扩展?,c#,visual-studio,report,code-coverage,opencover,C#,Visual Studio,Report,Code Coverage,Opencover,我试图使用以下命令提取应用程序的覆盖率报告 OpenCover.Console.exe ^ -register:user ^ -target:"mstest.exe" ^ -targetargs:"/testcontainer:\"C:\myapp\bin\myapp.dll\" /resultsfile:\"myapp.trx\"" ^ -filter:"+[myapp*]* -[myapp.Test]* -[*]myapp.RouteConfig" ^ -mergebyhash ^ -ski

我试图使用以下命令提取应用程序的覆盖率报告

OpenCover.Console.exe ^
-register:user ^
-target:"mstest.exe" ^
-targetargs:"/testcontainer:\"C:\myapp\bin\myapp.dll\" /resultsfile:\"myapp.trx\"" ^
-filter:"+[myapp*]* -[myapp.Test]* -[*]myapp.RouteConfig" ^
-mergebyhash ^
-skipautoprops ^
-output:"myapp.xml"
然后报告

.\ReportGenerator.exe ^
-reports:"F:\OpenCover\myapp.xml" ^
-targetdir:"ReportGenerator"
但是我在运行open cover时遇到以下错误

我的命令有什么不对吗


PS:我已经注册了open cover profiler

我使用的是mstest.exe,而不是在中运行测试用例

下面是使用open cover提取覆盖率报告的批处理文件代码片段

::Note:Before running this file, make sure opencover and reportgenerator installed in your system
::Download and read about opencover : https://github.com/OpenCover/opencover
::You can read about vstest.console command line documentation here https://msdn.microsoft.com/en-us/library/ms182486.aspx

::Set your project and report location's base path here
SET basePath=C:\MyProject
SET targetReportDir=F:\MyProject
SET targetHtmlReportDir=F:\MyProject\ReportGenerator

::Replace your test project Dll's path here
SET unitTestDlls=%basePath%\Demo.BusinessData\bin\Debug\Demo.BusinessData.Test.dll %basePath%\Demo.Cache.Test\bin\Debug\Demo.Cache.Test.dll


echo Test cases are running...
OpenCover.Console.exe -register:user -target:"vstest.console.exe" -targetargs:"%unitTestDlls%" -filter:"+[Demo*]* -[Demo*Test]* -[Demo*Test.Core]* -[Demo*Tests]*" -output:%targetReportDir%\DemoFullReport.xml -mergebyhash


echo Coverage report is preparing and will be saved to %targetHtmlReportDir%\Demo location
ReportGenerator.exe -reports:"%targetReportDir%\DemoFullReport.xml" -targetdir:"%targetHtmlReportDir%\Demo"
运行此批处理文件之前要检查的关键点

  • 确保已在visual studio命令行中设置或运行vstest.console环境
  • 确保您的opencover已设置并可通过命令行访问
  • 确保opencover报告生成器已设置并可通过命令行访问
  • 谢谢