Adding new OCL Library content

  1. Start adding a test by typing the following at the end of the testlib.oclx file (but before the endtests token) in the OCL editor:
    test myTest:
      let class : Class = getClassByName('C1')
      expected classy.name = 'C1'

    As soon as you type the test in the editor area, the new test appears at the bottom of the Outline view.

    New test in outline view

    In addition, These error annotations indicate that the library is semantically incorrect. If you hover over an error icon, a tool tip appears: Unrecognized variable: (classy). This is correct since the variable is unknown.

    Error annotations in vertical and overview ruler

  2. Correct the new test by changing the name of the variable to class.
  3. Notice that the error indicators disappear since the unknown variable has been removed.

Related concepts

OCL editor

Related reference

OCL Editor Preferences