This project is read-only.

Include all my cpp files

May 13 at 3:53 PM
Any way to have the report show any source files not covered by a test? Seems like if my test project is missing test for a file, that file is not included in the report.
May 15 at 3:07 PM
Looked into this some more and discovered that the linker for the test project was excluding source that it didn't need to link. I updated the settings but the report still does not contain any files that I do not touch with a unit test.
May 16 at 8:35 PM
Hello,

First, you can try to run OpenCppCoverage without filters (no --sources or --modules).
You can also try to run your program in debug mode to avoid inlining or optimization problems.

OpenCppCoverage creates a report for all the files available inside the pdb (except if you use --sources).

This command shows files available inside a pdb:
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\dbh.exe" YOUR_FILE.pdb src
where YOUR_FILE.pdb is the file for which you want to list sources.

Note: If you are not able to put a breakpoint in the missing file when debugging then OpenCppCoverage cannot cover it too.

I hope this will help,

OpenCppCoverage
May 29 at 2:52 PM
Any tips on getting my Test project pdb to include all the source from the main project? I'm generating a static lib and copying the main projects pdb along side it, but the test project pdb doesn't have a lot of source.
Jun 4 at 10:07 PM
Hello,

Did you try to run OpenCppCoverage without any filters on your program compiled in debug mode?
Are you able to put a breakpoint when debugging your unit tests in one of the file that is not reported by OpenCppCoverage?

If your code is a C++ template class, make sure it is instantiate in your test project.

Could you provide log file (LastCoverageResults.log) when running OpenCppCoverage in verbose mode (--verbose) and which files are not reported?

I hope this will help,

OpenCppCorage
Jun 5 at 1:36 AM
Yeah it all works fine. If I instantiate a class, it'll show up in the test report. The problem is the source I don't have any coverage on is not included in the report. So if my test project doesn't reference a class in a source file, it's not shown in the report. So the report shows a higher coverage because it isn't including everything.
And I can't seem to get the PDB file to include files that aren't referenced in the test project. It'd be nice if you could just point to a folder that contains the source and use that.
Jun 6 at 10:30 PM
Hello,

Let's take an example:
  • MyProject.dll is a dynamic library (dll) that contains 10 non template classes in 10 sources files (cpp).
  • MyTestProject.exe links to MyProject.dll and has a single test that cover only one class and so one file.
  • You should see in the coverage of your 10 files (9 of them should have a coverage of 0%).
If this is not the case, something is wrong:
  • in the way you call OpenCppCoverage or,
  • in your linker settings or
  • in OpenCppCoverage.
What do you mean by "Yeah it all works fine".
Is it for "Are you able to put a breakpoint when debugging your unit tests in one of the file that is not reported by OpenCppCoverage"

Can you provide the answers of the previous questions, it is hard for me to help you more without further information.
Here are the previous questions:
  • Did you try to run OpenCppCoverage without any filters on your program compiled in debug mode? Does it solve your problem?
  • Are you able to put a breakpoint when debugging your unit tests in one of the file that is not reported by OpenCppCoverage?
  • Could you provide log file (LastCoverageResults.log) when running OpenCppCoverage in verbose mode (--verbose) and which files are not reported?
Are you able to reproduce your problem on a small toy project? If yes, can you send it to me so that I will better understand your problem?

Please let me know if you solve your problem,

OpenCppCoverage
Marked as answer by OpenCppCoverage on 8/26/2017 at 6:01 AM