Skip to content

Automated test generation

Generates MC/DC (Modified Condition / Decision Coverage) tests for a circuit. The circuit is a Circuit subclass that registers its decision and condition nets by name in self.nets; compute_mcdc builds it twice and searches, with the engines, for the independence pair of each condition.

mcdc

Automated Test Generation for MC/DC (Modified Condition / Decision Coverage).

MC/DC asks, for every decision (a boolean expression) and each of its conditions (the atomic boolean sub-expressions), for a pair of tests that show the condition independently flips the decision. Such a pair is an independence pair, and the generated table collects one per condition. Two criteria say what independently means:

  • masking (the default): the two tests differ in the condition and in the decision, and in each the decision would change if the condition did; the other conditions may differ, where they do not decide;
  • unique-cause: the two tests differ in the condition and in the decision, and agree on every other condition. It is stricter: a condition coupled to another (x > 0 and x <= 0) may have a masking pair and no unique-cause one.

The circuit is given as a subclass of :class:intrepyd.circuit.Circuit (the same class the translators use). compute_mcdc builds it twice in the same context, as instances InstA and InstB under their own namespaces, and looks up the decision and condition nets by name in each instance's nets dictionary — so the circuit must register, in self.nets, every net named by decisions. See the documentation and tests/test_atg.py for an example.

compute_mcdc

compute_mcdc(context, class_, decisions, max_depth, criterion='masking')

Computes MC/DC tests in the form of a table, one per decision.

Args: context: the intrepyd context to use class_ (class): a subclass of :class:intrepyd.circuit.Circuit that builds the circuit and registers every decision and condition net, by name, in self.nets decisions (Dictionary): maps each decision to its conditions, all by net name (the names used as keys in the circuit's nets)::

        { decisionName : [conditionName, ...] }

max_depth (int): the maximum BMC depth to search for each test
criterion (str): ``"masking"`` (the default) or ``"unique-cause"``

Returns: a triple (tables, independence_pairs, unreachable): the raw MC/DC table per decision, the independence pair (two test indices) per condition, and the conditions whose objective is unreachable

get_tables_without_duplicates

get_tables_without_duplicates(decision2table)

The tables of compute_mcdc, each a header and its rows, without the rows that repeat an earlier one; a decision whose table has no row is left out

compute_pretty_tables

compute_pretty_tables(decision2table)

Postprocess raw MC/DC tables to get something presentation ready.