Structured Templates

A structured template consists of three files with a predefined meaning and base name. Their file extension can be chosen according to their content, for the standard report of Testwell CTC++, it is .html. All dynamically generated coverage content is located in these files.

Composition of a structured template

overview.xyz
One overview page is generated from this template file. In the report, it is named index.xyz. The overview page can contain coverage information on top level and detailed in a hierarchy of one or two levels.
detail.xyz
All detail pages are generated from this template file, and named detail-<n>.xyz in output. Detail pages can contain coverage information on their relative top level (for example, for one directory) and detailed in a hierarchy of one or two levels.
sourcecode.xyz
The source code views are generated from this template files, and named source-<n>.xyz in output. Source code views contain coverage information for one source file and may include its source code with related coverage counters and details.

With these three template files, every possible Layout Configuration can be supported: The layout determines if detail pages and source code views are generated. For overview and detail pages, it determines the granularity of information.

Additional static resources like logos, icons, scripts, CSS and JavaScript files may be provided. All additional resources are copied as they are to the output directory, keeping the folder structure from the template.

Content of the structured template files

For an HTML report as an example, each of the three template files uses
  • Standard HTML elements.
  • Variables enclosed in $...$ filled with content by ctcreport.
    <span class='Hits'>$Hits$</span>
  • Named loops indicating repetitive parts. Variables usually have a local meaning inside loops.
    <!-- CTC_LOOP("Symbolfiles") -->
    <li>
      <span class='FileName'>$FileName$</span>
      <span class='Timestamp'>$InstrumentationTime$</span>
    </li>
    <!-- CTC_LOOP_END("Symbolfiles") -->
  • Conditional definitions of variables. The variable $_Entities$ is defined in this example, depending on the condition Level2Available.
    <!-- CTC_DEFINE("_Entities"
                    "Level2Available"
                    "$Level1Entities$ and $Level2Entities$"
                    "$Level1Entities$")
    -->                   

For file extensions .html and .xml, ctcreport translates all characters "&", "<" and ">" (from function names, source code etc.) to "&amp;", "&lt;" or "&gt;", respecitvely.

Control structures for loops and definitions must be included in the style of HTML / XML comments, independent of the format chosen.