A validation-based metric definition is an attribute of a Metric Suite with the «ValidationBasedMetricDefinition» stereotype applied. In this attribute, you can specify a predefined validation rule for calculating metrics according to parameter values.
This chapter explains how to build a validation-based metric definition.
To build a validation-based metric definition
- Select the shape of a Metric Suite, click the smart manipulator on the shape, and select Validation-Based Metric Definition. An attribute with the «ValidationBasedMetricDefinition» stereotype is created.
- Type the name of the attribute directly on the shape and then click a free space on the diagram.
- Select the newly created validation-based metric definition on the Metric Suite shape and click .
Select the type of the result values that should be calculated according to the validation rule specified in the validation-based metric definition.
Specifying a result type
This step is mandatory. A validation-based metric definition must have a result type, e.g., Real or Integer.
Open the Specification window of the validation-based metric definition.
- Select the specification cell of the Validation Rule property and click .
In the Select Constraint dialog, select the validation rule that will be used to calculate metrics. Click OK.
- Select the specification cell of the Metric Type property. In the drop down list select the type of the metric you want to calculate.
Optionally, select the specification cell of the Failing Elements Definition property and enter the name of the menu item that displays failing elements according to the validation rule selected in step 7.
Displaying failing elements
To find the menu item that displays failing elements, right-click the Metric Table cell displaying the metric according to the selected validation rule. By default the menu item is Display Failing Elements, unless you give it a different name as described in step 9.
The validation-based metric definition for a Metric Suite is now specified and you can start calculating Metrics by using a Metric Table.