Control Coupling

Control Coupling is defined as “the manner or degree by which one software component influences the execution of another software component" in the Clarification of Structural Coverage Analyzes of Data Coupling and Control Coupling document edited by the Certification Authorities Software Team (CAST). The purpose is 'to provide a measurement and assurance of the correctness of these modules/components’ interactions and dependencies'. Control Coupling is used to verify that all the interactions between modules have been covered by at least one test.

HCL OneTest Embedded introduces a new coverage level called “Control Coupling" for C language that consists in verifying that all the interactions between modules have been covered by at least one test. This new coverage level is implemented in HCL OneTest Embedded in two ways:
  • Modules are compilation units, in this case:
    • Control Couplings are calls between two functions that are in two different compilation units.
    • Control Coupling is not a simple interaction. It is a control flow in the calling module that ends with an interaction with another module.
    • Groups of compilation units can be defined as a single module. This will increase the number of calls between modules but also increase the number of control flows in the calling modules.
    • The report contains a button to display:
      • All the Control Couplings (default option).
      • Only the shortest Control Couplings (only the last calls between modules are taken into account)
      • Only the longest Control Couplings (the sub-control flows are ignored)
  • Modules are Functions, in this case:
    • Control Couplings are considered as all the calls between two functions, in the same compilation unit or not.
    • Each Control Coupling is only a call, and not a control flow as previously defined.

So, to identify the Control Couplings, HCL OneTest Embedded analyzes all the external calls between modules (definition of the modules could be different depending on the option) and statically identifies all the possible paths in the calling module that end with each external call, excluding the one that starts with a static function (ex: a function that can't be called from another module). This constitutes the set of Control Coupling of the application.

For each of them, HCL OneTest Embedded provides the following information:
  • The calling modules.
  • The complete control flow (example: the set of successive calls, the last one is the external call). If the option "module as function" is set, each control flow has two functions only.
  • In case of option module as "compilation unit":
    • Is it the longest one that leads to this external call (it is not the longest when there is another Control Coupling that includes the current one).
    • Is it the shortest one that leads to this external call (it is not the shortest when there is another Control Coupling that is included by the current one).
  • It is covered or not.
  • The list of test cases that each Control Coupling covered.
  • The list of requirements that are related to the test cases.

How Control Coupling Works

When an application node or a test is executed, the source code is instrumented by the Instrumentor (attolcc4 for C language) that produces a static file with the extension .tsf containing information on the Control Couplings. The resulting source code is then compiled, linked and executed and the Control Coupling feature outputs a dynamic file with the extension .tgf.

These 2 types of files are the input of the report generator that produces a report in HTML format (and optionally the raw data can be generated in a Json file). A template is provided for this generator. You can provide your own template to modify the report.

If the Control Coupling feature is used with unit testing feature, the report generator can take the .tdc files as input files. This allows to have also in the report the test cases that covered each Control Coupling and the associated requirements declared in the .ptu file. If not, the test cases are identified by their execution date, and there is no requirement.
Note:

To visualize your report in HCL OneTest Embedded for Eclipse IDE, if you are using the default browser option, be sure that JavaScript is enabled. Otherwise, you can choose another browser that is compatible with your version of JavaScript by changing it in Window > Preferences > General > Web Browser .