Empty Report

Jul 21, 2016 at 5:34 PM
Edited Jul 21, 2016 at 5:38 PM
1) Created a hello world project.
2) Added google cpp testing framework GTest to the project.
3) Created a few simple tests.
4) Installed plugin for VS2015 and restarted VS2015
5) From the menu Tools==>Run OpenCPPCoverage
6) An empty HTML report is produced. (expected a code coverage report)

Image


Source code:
// HelloWorldTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include "gtest/gtest.h"
GTEST_API_ int main(int argc, char **argv) {
    printf("Running main() from gtest_main.cc\n");
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

// Testing 
// ----------------------------------------------------------------------------
TEST(HelloWorld, TestingTrue) {
    EXPECT_TRUE(true);
}
TEST(HelloWorld, TestingFalse) {
    EXPECT_FALSE(false); 
}
TEST(HelloWorld, TestingEqual) {
    EXPECT_EQ(123, 123); 
}
In the console window I get the following output
[info] Start Program:
Path:"X:\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe"
Arguments:
Working directory: not set.

Modules: Selected: X:\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe Excluded:
Sources: Selected: X:\XXXX\XXX-testing\example\HelloWorldTest\HelloWorldTest Excluded:
Log Level: Normal
Cover Children: 0
Aggregate by file: 1
Export: Html C:\Users\user\AppData\Local\Temp\1qpzw1lj.wqi Input coverage:

[info] Module: E:\xdrive\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe is skipped because it matches no selected patterns
I assume the issue is with "skipped because it matches no selected patterns" but I am not sure how to resolve this issue.
Jul 22, 2016 at 9:50 AM
It probably has to do with module filters. Personally I found them to be a bit of a pain, which is why my own addin simply accepts everything underneath the solution folder.

The OpenCPPCoverage team is building a new VS addin, which they intend to release after the summer. Until then, I suggest trying https://github.com/atlaste/VSOpenCPPCoverage , it might solve your issue here.
Coordinator
Jul 27, 2016 at 9:27 PM
Hello,

Your analysis is correct, the path of your executable ([info] Module: E:\xdrive\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe) does not match the filter (_Modules: Selected: X:\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe)

I am able to reproduce your problem when using a network drive with (subst).
I created a project in C:\Dev\ConsoleApplication1 and mapped Z: to C:\Dev
  • If I open Visual Studio from C:\Dev\ConsoleApplication1\ConsoleApplication1.sln and run the plugin, the coverage is ok.
  • If I open Visual Studio from Z:\ConsoleApplication1\ConsoleApplication1.sln the coverage is empty.
It is possible for you to not use network drive?
If not, you can try to use OpenCppCoverage command line version. Please see Network path special considerations here.

Let me know if it help,

OpenCppCoverage
Aug 2, 2016 at 7:00 PM
You are correct OpenCppCoverage. I was using a subst drive.
I compiled from a normal drive and this issue was resolved.

Thank you.
Marked as answer by OpenCppCoverage on 8/19/2016 at 7:31 AM