You can run a UML Metrics analysis configuration on a UML model
to collect 19 different types of information about the model.
For example, you can discover the number of diagrams, the number of classes
in a package, or the depth of a classifier in its inheritance hierarchy. UML
metrics are grouped into four categories: coupling, diagrams, inheritance,
and size. Metrics that express the number of occurrences for each namespace
are summed and all other metrics are averaged. For each metric, you can optionally
configure the severity, lower bound, and upper bound. Metrics that are out
of the range of the lower and upper bounds are reported as problems and are
displayed in red. To inspect metrics results, you expand the result tree starting
at the root and read the results from the bottom up.
To collect metrics on a UML model:
- Click
- In the Analysis window, right-click Analysis;
then click New.
- In the Name field, type a name for the configuration.
- On the Scope page, select one of the following
options:
- To analyze all the resources in your workspace, click Analyze
entire workspace.
- To analyze resources in a working set that you previously defined,
click Analyze a resource working set and select the
resource working sets to include in the analysis.
- To analyze specific projects, click Analyze selected projects and
select the projects to include in the analysis.
- Optional: On the Rules page,
complete the following steps:
- In the Analysis Domains and Rules list,
select Model Metrics for UML.
- On the Properties tab, refine the scope
of the analysis to include referenced or closed resources.
- In the Analysis Domains and Rules list,
expand Model Metrics for UML and expand any of the
four metrics categories. Select the check boxes beside the metrics that you
want to collect.
- Optional: To change the severity rating, the lowest
allowed value, and the highest allowed value, click the rule and change the
rule parameters on the Properties tab.
- Click Apply and click Analyze.
The results are displayed in the Analysis Result view, on the Model
Metrics for UML tab.
- Optional: To work with the results of the analysis,
in the Analysis Result view, click the Model Metrics for UML tab
and complete any of the following steps:
- To filter the results to display only problems, click Filter.
Click Filter again to display all the metrics.
- To export model review analysis results to an XML file, click Export.
Specify the export format and file name and click OK.
- To generate an HTML or PDF report of the analysis results, click Report,
select the report format, and click OK.
- To navigate from a result to a problematic element in the Project
Explorer view, either right-click the result; then click View
result or double-click the result.