OpenCover和GoogleTest - 抱怨丢失的PDB

时间:2013-07-12 00:58:28

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

我目前正在使用的构建在32位环境中使用Visual Studio 2008(Professional)进行编译。我们一直在使用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)"

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

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 argument
  • 我曾尝试使用-targetargs:“/ noshadow”(以及noisolation),我相信这些特定于MSTest和NUnit,但不适用于GoogleTest
  • 我尝试省略了targetdir参数
  • 我已安装VS 2010重新分发

所有这些都产生相同的结果。我能够运行安装附带的示例。

有没有人成功将Google测试框架与OpenCover集成?或者项目中是否有特定的编译设置? (我打开/关闭分析,并没有什么区别)

谢谢!

1 个答案:

答案 0 :(得分:0)

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

由于您使用的是GoogleTest,因此我只能假设您的代码是原生的,这可以解释为什么您没有覆盖。