Categorize Models in a Hierarchy as Components or Units
When testing your model-based software architecture, there are different testing requirements for different levels of the architecture. The dashboard helps you to focus on the models that require unit testing so you can assess their testing quality. You can use labels to classify the models in your projects as units or components, then use the dashboard to see the hierarchy. For more information on how to analyze the testing requirements for a unit, see Explore Status and Quality of Testing Activities Using Model Testing Dashboard.
Units in the Dashboard
A unit is a functional entity in your software architecture that you can execute and test independently or as part of larger system tests. Software development standards, such as ISO 26262-6, define objectives for unit testing. Unit tests typically must cover each of the requirements for the unit and must demonstrate traceability between the requirements, the test cases, and the unit. Unit tests must also meet certain coverage objectives for the unit, such as modified condition/decision coverage (MC/DC).
You can label models as units in the dashboard. If you do not specify the models that are considered units, then the dashboard considers a model to be a unit if it does not reference other models.
In the Dashboard window, in the Project panel, the unit dashboard icon indicates a unit. If a unit is referenced by a component, it appears under the component in the Project panel. If a unit references one or more other models, those models are part of the unit. The referenced models appear in the Design folder under the unit and contribute to the metric results for the unit.
To specify which models are units, label them in your project and configure the dashboard to recognize the label, as shown in Specify Models as Components and Units.
Components in the Dashboard
A component is an entity that integrates multiple testable units together. For example:
A model that references multiple unit models could be a component model.
A System Composer™ architecture model could be a component. Supported architectures include System Composer architecture models, System Composer software architecture models, and AUTOSAR architectures.
A component could also integrate other components.
The dashboard organizes components and units under the components that reference them in the Project panel.
If you do not specify the models that are considered components, then the dashboard considers a model to be a component if it references one or more other models.
In the Dashboard window, in the Project panel, the component icon indicates a component. To see the units under a component, expand the component node by clicking the arrow next to the component icon.
To specify the models that are considered components, label them in your project and configure the dashboard to recognize the label, as shown in Specify Models as Components and Units.
Specify Models as Components and Units
You can control which models appear as units and components by labeling them in your project and configuring the dashboard to recognize the labels.
Open a project. To open the dashboard example project, at the command line, enter
dashboardCCProjectStart. This example project already has component and unit models configured.
In MATLAB®, at the bottom left of the Project window, right-click in the Labels pane and click Create New Category. Type a name for the category that will contain your testing architecture labels, for example,
Testing Interfaceand then click Create.
Create a label for the units. On the Labels pane, right-click the category that you created and click Create New Label. Type the label name
Software Unitand click OK.
Create another label for component models and name the label
The unit and component labels appear under the category in the Labels pane.
Label the models in the project as components and units. In the project pane, right-click a model and click Add label. In the dialog box, select the label and click OK. For this example, apply these labels:
db_Controller— Software Component
db_ControlMode— Software Unit
db_DriverSwRequest— Software Unit
db_LightControl— Software Unit
db_TargetSpeedThrottle— Software Unit
Open the Dashboard window by using one of these approaches:
On the Project tab, in the Tools section, click Model Testing Dashboard.
On the Project tab, in the Tools section, click Model Design Dashboard.
In the Dashboard tab, click Options.
In the Project Options dialog box, in the Classification section, specify the category and labels that you created for the components and units. For the component interface, set Category to
Testing Interfaceand Label to
Software Component. For the unit interface, set Category to
Testing Interfaceand Label to
Click Apply. The dashboard updates the traceability information in the Project panel and organizes the models under the component models that reference them. If a model is not referenced by a component, it appears at the top level with the components.
To open a dashboard for a unit or component, click the name of the unit or component in the Project panel. The dashboard shows the metric results for the unit or component you select.