Adding new OCL Library content
- 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.
In addition,
- error icons appear in the Package Explorer view
- errors appear in the Problems view,
- error icons appear in the Outline view,
- error annotations (red boxes) appear in the overview ruler positioned on the right hand side of the editor,
- error icons appear in the vertical ruler positioned on the left of the editor,
- an error indicator appears in the top right corner of the editor,
- errors are marked in the text.
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.
- Correct the new test by changing the name of the variable to
class.
- Notice that the error indicators disappear since the unknown variable has been removed.
OCL editor
OCL Editor Preferences