Structured Templates

A structured template is a ZIP package consisting of three files with a predefined meaning and base name. All dynamically generated coverage content is located in these three files. Additional static resources can be provided.

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 coverage details 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 coverage details in a hierarchy of one or two levels.
sourcecode.xyz
The source code views are generated from this template file, and named source-<n>.xyz in output. Source code views contain coverage information for one source file and 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.

The file extension can be chosen according to the content, separately for each of the three files. For the standard report of Testwell CTC++, the extension is .html.

Additional static resources like logos, icons, scripts, CSS and JavaScript files may be provided. They are copied 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, user variable values etc.) to "&amp;", "&lt;" or "&gt;", respecitvely.

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