Logo BCDDLogo CSC
BCDDBehavioural Contract-Driven Design
version 1.0-beta
ITEN

Chapter 26 — The verification plan

Chapter 24 described the outcomes of recording verification, chapter 25 the way in which each element of a boundary appears. The verification plan relates them: it indicates with which instruments a boundary is recorded, with what resolution, and which guarantees each instrument observes.

bcdd reads the verification plan, checks its names and calculates which guarantees each instrument observes. No program described in this manual executes a verification plan or recording verification.

The verification plan

A recording instrument is a tool that records what happens at a boundary through the concrete forms of the boundary: a recorder connected to a terminal, a sensor, a camera, a program that records the messages of a network. A test tool built into the system, such as a test option of a program, is also a recording instrument; the way to activate it is a concrete form. An instrument observes what it records: an element that no instrument records is not observed.

The resolution of an instrument is the smallest time interval that the instrument distinguishes.

The verification plan of a boundary is written in a VERIFICATION … END block, whose header names the bound CSC with its version. It contains:

  1. the recording instruments, each with the elements of the CSC that it observes and its resolution;
  2. the scenarios written in concrete forms, each with the scenario of the CSC that it translates.

bcdd calculates the guarantees that each instrument observes and those that no instrument observes, which remain not executed. The verification plan does not contain guarantees and does not contain outcomes: it establishes how the recordings on which the guarantees are verified are collected.

The recording instruments of the light

For the staircase light two instruments are used: a light sensor in front of the lamp, with a resolution of one millisecond, and a camera that films the button and the lamp together at 25 frames per second, with a resolution of 40 ms. A recorder connected between terminal 3 and the common terminal observes instead the boundary Comando, which has its own verification plan. The verification plan is in a file of its own, PianoLuce.csc:

-- The verification plan of the staircase light.

VERIFICATION UsoLuce VERSION 0.3
  MEANS sensore    OBSERVES modo, avviso RESOLUTION 1 ms
  MEANS telecamera OBSERVES premuto, modo RESOLUTION 40 ms
  SCENARIO s1-scale TRANSLATES s1
    @0 s     VERBAL "a finger presses the key of the wall button; the lamp switches on"
    @85 s    VERBAL "the lamp switches off for 0.3 s and switches on again"
    @90 s    VERBAL "the lamp switches off"
    @100 s   VERBAL "a finger presses the key again; the lamp switches on"
END

VERIFICATION Comando VERSION 0.1
  MEANS registratore OBSERVES accendi RESOLUTION 1 ms USING filo
END

A MEANS line declares an instrument: the name, the elements of the bound CSC that it observes (OBSERVES) and the resolution (RESOLUTION), a duration with a unit. With USING the instrument names the BINDING through which it observes: the recorder reads the accendi events in the form of the wired button, the block AS filo of chapter 25. The sensor records whether the lamp is on or off, and the concrete forms of chapter 25 establish how to read the recording: a lamp off for 0.3 s and then on again is an avviso, a lamp off is modo = spenta. The specification leaves to whoever implements the system the way of obtaining traces from recordings.

The guarantees observed by each instrument

A formal guarantee that cites an element that is not recorded has the outcome not executed (chapter 24). bcdd calculates, for each instrument, the formal guarantees and assumptions that the instrument observes in full: a line is observed by an instrument if every state, event and request it names is among its OBSERVES elements. The lines that no instrument observes in full are not executed. Verbal lines do not take part in this calculation: they are verified by judgement or by inspection.

$ bcdd check PianoLuce.csc
bcdd check PianoLuce.csc
lines: 15 (recognised 12, comments 1, blank 2, unrecognised 0)
blocks: 2
  line 3: VERIFICATION UsoLuce VERSION 0.3
    line 3: CSC UsoLuce in UsoLuce.csc at line 4: VERSION 0.3, STATUS HYPOTHESIS, no errors
  line 13: VERIFICATION Comando VERSION 0.1
    line 13: CSC Comando in Comando.csc at line 3: VERSION 0.1, STATUS HYPOTHESIS, no errors
    line 14: USING filo in Comando.csc at line 13

1. ERRORS: 0

2. DEGREE OF THE CONTRACTUAL LINES
  verbal: 0
  formal: 0
  declared extension: 0
  unrecognised: 0

3. UNDECIDED: 0

4. PENDING APPROVAL, NOT CONTRACT: 0

5. UNRECOGNISED LINES: 0

6. UNDECLARED TYPES: 0

7. CSCs NAMED BUT NOT CHECKED: 0

13. VERIFICATION PLAN COVERAGE: 4
  line 3: VERIFICATION UsoLuce VERSION 0.3
    sensore (line 4): g2, g8
    telecamera (line 5): g1, g2, g2a, g7a, g9
    not executed: g3a, g4a, g4b, g10
  line 13: VERIFICATION Comando VERSION 0.1
    registratore (line 14): none
    not executed: none

outcome: no errors

Section 13, VERIFICATION PLAN COVERAGE, shows the calculation:

The count of the section is the number of guarantees not executed. The section appears only when the file contains at least one VERIFICATION block, and it is not an error. The list of observed guarantees is not written in the file: bcdd derives it each time from the OBSERVES lines.

Section 13 also lists the guarantees not executed. A verification report that omitted them would suggest that they have been verified.

With the sensor alone, without the camera, the press is not recorded by any instrument:

13. VERIFICATION PLAN COVERAGE: 8
  line 3: VERIFICATION UsoLuce VERSION 0.3
    sensore (line 4): g2, g8
    not executed: g1, g2a, g3a, g4a, g4b, g7a, g9, g10
  line 12: VERIFICATION Comando VERSION 0.1
    registratore (line 13): none
    not executed: none

The recorder detects the accendi events, which follow the presses, but not the presses. Deriving a press from an accendi would require guarantee pu1 of the button (chapter 13), and a guarantee does not replace an observation: for this reason g1 remains not executed as long as no instrument records premuto.

The resolution

The resolution limits the scope of an outcome. “Satisfied on the trace” applies with the declared resolution of the instrument (chapter 24): for g2a, which admits a switch-off between 85 and 95 seconds after the last press, a resolution of 40 ms is sufficient. For g1, which requires the light on in the same step as the press, the outcome depends on the criterion by which, starting from the recording, it is established that the two facts fall in the same step. Two facts recorded by different instruments are considered to be in distinct steps only if their distance exceeds the coarser resolution of the two instruments. Otherwise the temporal relation is indeterminate: it is not established whether the facts are in the same step or in distinct steps. If an instrument with a resolution of 40 ms records the press at 10.000 s and another records the light on at 10.015 s, the two facts are not distinguished and g1 is inconclusive in that step; if the light comes on at 10.200 s, g1 is violated.

An instrument that distinguishes only intervals longer than the duration of a concrete form does not observe it. A light sensor that detects the state of the lamp once per second may fail to detect a 0.3 s flash: in the verification plan avviso does not figure among the elements that sensor observes, and g8 has the outcome “not executed”. Declaring avviso among the observed elements would give g8 the outcome “satisfied on the trace” even on a recording in which a warning slipped between two readings. bcdd does not compare the resolution with the concrete forms: the choice of the OBSERVES elements remains with whoever writes the plan.

Scenarios in concrete forms

A translated scenario rewrites a scenario of the CSC in the concrete forms: SCENARIO s1-scale TRANSLATES s1 translates scenario s1 of UsoLuce. Its steps have the times of the scenario it translates and contain assertions in words (VERBAL). It has neither GIVEN nor EXPECT: its expected outcome is that of the scenario it translates. If the bound CSC does not have the named scenario, bcdd reports error E31.

Some facts that arise in the concrete forms do not appear in the scenario of the CSC, and on them an implementation can behave incorrectly. A 30 ms contact on terminal 3, for example, is not an accendi (chapter 25), and it does not appear in the scenario of the CSC Comando. The verification plan of Comando can then contain a translated scenario: “contact closed for 30 ms at instant 0 s, contact closed for 80 ms at instant 1 s”. This scenario translates a scenario of Comando with a single accendi, that of the second contact. A lamp that comes on already at the first contact treats as accendi a contact that is not one: the translated scenario allows this to be detected, whereas the scenario of the CSC Comando, on its own, does not contain the 30 ms contact.

Summary

Special cases

A verification plan is not approved. For a STATUS line in a VERIFICATION block bcdd reports error E39; in the same file, for a translated scenario that names a scenario absent from the CSC it reports error E31:

1. ERRORS: 2
  line 4: [E39] STATUS cannot appear in a VERIFICATION: a verification plan is not approved
  line 7: [E31] TRANSLATES names a scenario that CSC UsoLuce VERSION 0.3 does not have: s9

bcdd ratify refuses a file that contains only verification plans:

$ bcdd ratify PianoLuce.csc --all D-22
bcdd ratify: the file contains no block to approve: a VERIFICATION is not approved

An instrument connected inside a part. A recorder connected to the terminals that supply the bulb, inside the lamp, records the implementation and not a boundary: no guarantee can be verified on that recording. The verification plan associates each instrument with a boundary, through the concrete forms of the boundary.

A verbal guarantee and the recorder. Guarantee c1 of Comando, “at least 0.2 s pass between two accendi”, is checked by inspection on the “recorded commands”: the recording of the recorder is the material of the inspection. The outcome remains a judgement, “conforming by judgement” or “non-conforming by judgement”, with who judged, and is reported separately from the outcomes of formulas (chapter 24). For this reason the recorder observes no formal guarantee of Comando, and section 13 shows it with none.

Several recordings of the same guarantee. A guarantee satisfied on ten recordings remains satisfied on those ten traces, with the resolution of the instruments used: the number of recordings does not turn the outcome into a certainty about the situations not observed.