Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

verification def

This notebook introduces verification def; after running it you can declare a named verification case that specifies how a requirement will be checked.

Notebooks 01–03 of this chapter established the requirement usage timely : TimelyToast, a satisfaction claim demonstrating the requirement’s failing branch (slow), and a threshold judgment record. A complete requirement has three parts (Part 4): description, rationale, and verification method. The first two are in TimelyToast’s doc comment (Chapter 2, §7.21.2). verification def in SysML v2 (§7.24) closes the anatomy by declaring how the requirement will be verified: the subject under test, and an objective that names the requirement usage to verify.

verification def TimelyToastTest {

verification def TimelyToastTest declares a reusable verification case for the toasting cycle requirement. Like requirement def, a verification def takes a subject (the system under test) and a body specifying what must be determined.

    doc /*
     * Verification method: timed test of three consecutive toasting cycles at
     * nominal input power; all must complete within 180 seconds.
     * Method type: test (VerificationMethodKind::test, SysML v2 §7.24 Table 22).
     * Note: formal #verificationMethod metadata not yet supported in OpenSysML v0.9.0;
     * tracked at toaster#19 / OpenSysML#608.
     */

The doc block holds the informal text of the verification case. It describes the verification method as a timed test. The formal #verificationMethod = VerificationMethodKind::test metadata annotation (§7.24 Table 22) is the spec-defined way to declare the method kind; it is not yet supported in the OpenSysML runtime v0.9.0 (toaster#19 / OpenSysML#608).

    subject toaster : Toaster;

The subject toaster : Toaster declaration names the entity under test: any Toaster instance placed in this verification role.

    objective {
        verify timely;
    }

The objective block names the requirement usage being verified: timely : TimelyToast from notebook 01. verify timely is a shorthand satisfy constraint (§7.24.2) that asserts the objective is met when timely is determined to hold for the subject. verify takes a requirement usage, not a definition: verify TimelyToast would fail because TimelyToast is a requirementDef, not a usage.

The verification case loads without diagnostics. The next cell checks what happens when its objective names a requirement definition instead of a usage.

Expected error: satisfy target must be a requirement usage, found requirementDef

With the negative control confirmed, the next cell looks up the verification case in the loaded model.

verification kind : verificationCaseDef
verification id   : ToasterDemo::TimelyToastTest
VerificationCaseDefinition: ToasterDemo::TimelyToastTest

The TimelyToastTest fragments printed above loaded without error, and model.find() returns its symbol, confirmed as a VerificationCaseDefinition by model.query() above.

Try the chapter exercise in exercises/ch03/exercise.ipynb: declare a BrewTempTest verification case for your coffee maker’s temperature requirement, with an objective that verifies the requirement usage from notebook 01.