3

This is my cmake files, which create binary, which have only Unit tests:

cmake_minimum_required(VERSION 3.2)
set(MODULE_NAME UnitTests)

set (CMAKE_CXX_STANDARD 11)

find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/../MyProject)

set(SOURCE_EXE tests.cpp ../MyProject/SomeClass1.cpp ../MyProject/SomeClass2.cpp )

add_executable(${MODULE_NAME} ${SOURCE_EXE})

target_link_libraries(${MODULE_NAME} ${GTEST_LIBRARIES} pthread)

in tests cpp:

#include "SomeClass1.h"
#include "SomeClass2.h"
#include <gtest/gtest.h>

using namespace std;

TEST(testcase1, test1)
{
    SomeClass1 s1;
    //test some functions from SomeClass1
}

TEST(testcase2, test1)
{
    SomeClass2 s2;
    //test some functions from SomeClass2
}

I build the project with Unit tests using cmake and then I used kcov utility:

kcov /home/myuser/kcov/ UnitTests

and it showed me 0.0% coveredCoverage Report

What am I doing wrong, when I use this utility https://github.com/SimonKagstrom/kcov ?

Dasd
  • 111
  • 1
  • 3
  • 7

0 Answers0