【问题标题】:OpenCover and GoogleTest - Complains missing PDBsOpenCover 和 GoogleTest - 抱怨缺少 PDB
【发布时间】:2013-07-12 11:38:30
【问题描述】:

我目前正在处理的构建使用 Visual Studio 2008 (Professional) 在 32 位环境中进行编译。我们一直在使用 Google Test Framework 来创建单元测试。我们正在尝试使用 OpenCover 报告代码覆盖率,它会返回

"no results - no assemblies that matched the supplied filter were instrumented. this could be due to missing PDBs for the assemblies that match the filter. please review the output file and refer to the Usage guide (Usage.rtf)"

当我看到控制台上显示的结果时,Test 可执行文件确实运行了。 PDB 与 Google 测试可执行文件位于同一目录中。我用过的命令:

OpenCover.Console.exe -target:<Full Path Unit Test Executable> -targetdir:<Directory of the exeutable which also includes the PDB> -output:cover.xml

注意:目录和可执行文件不包含空格,所以我省略了引号,但我尝试过使用或不使用,结果是一样的

我尝试过的事情:

  • 我已经明确注册了 OpenCover.Profile.dll
  • 我使用了 -register:user 参数
  • 我曾尝试使用 -targetargs:"/noshadow"(和噪声隔离),我相信这些是特定于 MSTest 和 NUnit,但不适用于 GoogleTest
  • 我已尝试省略 targetdir 参数
  • 我已经安装了VS 2010再分发版

它们都产生相同的结果。我能够运行安装附带的示例。

有没有人成功地将 Google 测试框架与 OpenCover 集成?还是项目上有特定的编译设置? (我已经打开/关闭了分析,但没有任何区别)

谢谢!

【问题讨论】:

    标签: visual-studio-2008 code-coverage googletest opencover


    【解决方案1】:

    OpenCover 用于覆盖编译为 IL (.NET) 的代码,而GoogleTest 用于测试本机 (x86) 代码。

    由于您使用的是 GoogleTest,所以我只能假设您的代码是本机代码,这可以解释为什么您没有得到覆盖。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-31
      • 2018-06-25
      • 1970-01-01
      • 2017-05-14
      • 2021-11-30
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多