Skip to content

Teamscale Compact Coverage

Report Format

Note: This format is experimental and might be removed again without prior notice.

Teamscale Compact Coverage is a Teamscale-specific coverage format that allows to upload coverage information in a compressed format to reduce the amount of data processed by the Teamscale instance.

Preliminaries

  • Line range string
    • String containing line ranges and individual lines separated by commas.
    • Compact representation of a set of lines of code.
    • Example: "10-12,13,22-27,40"

TeamscaleCompactCoverageReport

The top level JSON object is the TeamscaleCompactCoverageReport. It contains the following attributes:

versionintrequired
  • The version for the format described here should be 1.
  • Version number for the Teamscale Compact Coverage report version.
  • If not given the parser will fall back to version 1 of the Teamscale Compact Coverage format.
coverageArray<CompactCoverageFileInfo>required

CompactCoverageFileInfo

Aggregated coverage information about a source code file. It contains the following attributes.

filePathstringrequired
  • The source file path
  • Typically relative to the project's root, but might also be an absolute path.
fullyCoveredLinesstringrequired
  • Line range string for the lines in the source code that are fully covered, i.e. all possible branches of this line are covered.
partiallyCoveredLinesstringoptional
  • Line range string for the lines in the source code that are partially covered.
  • A line is partially covered if at least one, but not all possible branches in this line are covered.
uncoveredLinesstringoptional
  • Line range string for the lines in the source code that are not covered, i.e. the line is coverable but has not been executed by any test case.
coverageProbesArray<CoverageProbe>optional
  • See section for CoverageProbe.
  • Can both contain DecisionProbes and StatementProbes.

CoverageProbe

CoverageProbes are generic coverage "indicators" associated with a source line (the start line of the corresponding statement). Probes can be of types DecisionProbe and StatementProbe as defined by the attribute type. For example in case of branch coverage, a probe may indicate for an if-condition how many times it was evaluated to true and how often to false.

DecisionProbe

Probe for a decision, e.g. an if-statement, which carries two execution counters.

typestringrequired
  • Set to "decision".
lineintrequired
  • 1-based line number of the associated statement.
trueExecutionCountintrequired
  • Number of executions the expression evaluated to true.
falseExecutionCountintrequired
  • Number of executions the expression evaluated to false.
configurationsArray<DecisionProbeConfiguration>required
  • See section for DecisionProbeConfiguration.
conditionsArray<McDcCondition>required
  • See section for McDcCondition.

DecisionProbeConfiguration

A configuration for the individual conditions in a decision. We are looking at an example for the condition if (val == 1 && val2 == 2 && val3 == 3).

descriptionstringrequired
  • The evaluation result of the individual conditions in the decision.
  • "T || F || _" indicates that the first expression evaluated to true, the second one to false, and the third one to "Don't care"/"Not executed".
decisionValuebooleanrequired
  • The overall truth value of the combined decision, based on the valuation in description.
executionCountintrequired
  • The number the probes which evaluated to this exact specific configuration.

McDcCondition

An MC/DC condition necessary to meet the MC/DC criterion consisting of a textual description and the information whether it was fulfilled.

descriptionstringrequired
  • The evaluation result of the individual conditions in the decision.
  • Equivalent to the format of DecisionProbeConfiguration#description.
fulfilledbooleanrequired
  • Flag whether the MC/DC condition was fulfilled.

StatementProbe

Simple probe that carries a single execution count.

typestringrequired
  • Set to "statement".
lineintrequired
  • 1-based line number of the associated statement.
executionCountintrequired
  • The total number of executions of this probe.

Sample File

The following JSON sample file combines the data described above.

json
{
  "version": 1,
  "coverage": [
    {
      "filePath": "Simple.java",
      "fullyCoveredLines": "1-3",
      "partiallyCoveredLines": "4,6"
    },
    {
      "filePath": "StringUtils.java",
      "fullyCoveredLines": "1,3",
      "partiallyCoveredLines": "4-6",
      "uncoveredLines": "2",
      "coverageProbes": [
        {
          "type": "decision",
          "line": 2,
          "trueExecutionCount": 0,
          "falseExecutionCount": 1,
          "configurations": [
            {
              "description": "T || F || _",
              "decisionValue": false,
              "executionCount": 1
            }
          ],
          "conditions": [
            {
              "description": "T || T",
              "fulfilled": true
            }
          ]
        },
        {
          "type": "statement",
          "line": 3,
          "executionCount": 1
        }
      ]
    }
  ]
}