简体   繁体   中英

Visual Studio 2012 C++ code coverage merge executables

My c++ unit tests use gtest framework so every test is a separate executable. I'm running the CodeCoverage.exe tool to get the raw coverage data of each executable run. When I open the results in Visual Studio, each executable run appears in a separate branch and the results can't be merged together.
Is there any way to make this work?

One thing I've tried is to specify /session:uniq in the command line for both runs but that didn't have any effect.

Does it help you to capture via vsperfcmd.exe?

  1. Build your gtest with /profile flag specified to the linker
  2. Instrument your gtest exe with Visual Studio coverage instrumentation
    • vsinstr.exe gtest.exe /COVERAGE
  3. Launch the code coverage capture tool
    • vsperfmon.exe /COVERAGE /OUTPUT:gtest.coverage
  4. Run the gtest
  5. Stop the capture tool
    • vsperfcmd.exe -shutdown
  6. Launch the output file (gtest.coverage) to see the output in Visual Studio

OK, this should have been a comment, but I don't have the permissions yet. You can run all your unit tests with the macro: RUN_ALL_TESTS();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM