You can run a UML Metrics analysis configuration on a UML
model to collect several different types of numeric information about
the model. For example, you can discover the number of attributes
or operations in a classifier, the level of instability 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.
About this task
To collect metrics on a UML model:
Procedure
- Click
- In the Analysis window, right-click Software
Analyzer; 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 UML Model Metrics.
- On the Properties tab, click the Analyze
Referenced Resource checkbox to also analyze resources
referenced from your scope.
- In the Analysis Domains and Rules list,
expand UML Model Metrics 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 Software Analyzer Result view, on
the UML Model Metrics tab.
- Optional: To work with the results of the analysis,
in the Software Analyzer view, click the UML Model Metrics tab
and complete any of the following steps:
- To filter the results to display only problems, click Show
problem metrics only. Click Show problem metrics
only 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 Generate a 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.