Open the Class Diagram Viewer. In the Class Browser
pane, expand the Import Class, Folder, or File button and select .
Enter matlab.unittest
as the package name and click
OK. The folder for unittest
appears in the
Class Browser.
Expand the unittest
folder and select the
InteractiveTestCase
class. Click the Add button in
the toolbar to add a card for the class to the Class Diagram Viewer
canvas. Add the TestCase
class using the same method. Because
TestCase
is the superclass of InteractiveTestCase
, Class
Diagram Viewer automatically draws an arrow from InteractiveTestCase
to
TestCase
to show this relationship.
The striped blue borders at the top of the class cards indicate that both of these
classes are handle classes. The Legend pane describes what the
graphic effects and icons on the canvas represent.
You can also drag and drop items from the Class Browser
directly to the canvas. Drag and drop the Test
class to the viewer. The at the top of the card indicates that
Test
has a viewable superclass.
Click the to add the superclass to the diagram. The arrow
pointing to TestSuite
from Test
indicates that
TestSuite
is a superclass of Test
.
In addition to moving the classes in the viewer by dragging and dropping, you can
customize the view using the options in the Zoom and Pan section of
the toolbar, including:
In the View section, select the Mixins
check box. This action does not automatically add mixin classes to the diagram, but
going forward, the viewer adds them to the display when you perform any action that adds
superclasses.
To add all the superclasses of Test
, right-click the
Test
class card and select Add All Superclasses.
The CustomDisplay
mixin now appears as a superclass of
Test
, and TestSuiteExtension
appears as a superclass of
TestSuite
. The name of CustomDisplay
is italicized,
indicating that it is an abstract class.
You have two options each for adding superclasses and subclasses:
Add Superclasses: Add superclasses that the given class
inherits directly from.
Add All Superclasses: Add all superclasses that the given
class inherits directly or indirectly from. In the example above,
Test
indirectly inherits from
TestSuiteExpansion
.
Add Subclasses: Add known subclasses that inherit directly
from the given class.
Add All Subclasses: Add all known subclasses that inherit
directly or indirectly from the given class.
Note
MATLAB might not identify all existing subclasses of a given class. In that
case, use the Class Browser to add any additional subclasses manually.
In addition to relationships between classes, you can also explore the class
definitions themselves. Expand the Test
class card by clicking the arrow
next to the class name in its card. The class card expands to show the properties and
methods defined by the class. Properties and methods inherited from superclasses do not
appear in the subclass cards.
The icons next to the property and method names identify the access levels of the
properties and methods. For example, the lock icon shows that
ExternalFixtures
is a private property.
Selecting a property or method on the class card also displays access and other
information in the Inspector pane.
To view the source code of one or more classes, select their cards and click
Go To Source in the toolbar. The source code files open in the
MATLAB Editor.
To save or share your diagram, use one of two options: