Instrumentation of Included Files
Header files and other included files can be instrumented with Testwell CTC++ like any other source file. Based on the include mechanism of C and C++, the handling and reporting consequences differ slightly.
For the purpose of coverage measurement, "header" and "included file" can be seen as
synonyms. Both terms are used here, depending on the context. Relevant for Testwell CTC++ is that these files are not directly compiled, but
included via #include
in another source file. Not relevant is if these
files are actually header files, or if they are, for example, normal source files
included for unit testing.
EXCLUDE = %INCLUDES%
to avoid
instrumentation of system headers.During instrumentation and testing, each #include
of file X in another
source file is processed separately: File X is represented in the symbol file(s) in a
copy for each inclusion. These copies might differ due to preprocessor directives. Each
copy of X has its own, independent coverage counters.
When reports are generated from symbol and data files with ctcreport, the different copies are consolidated to one or more variants.
To get coverage for an included file, all source files including X must be instrumented. They can be excluded from reports later.