matlab.unittest.selectors.HasTag Class
Namespace: matlab.unittest.selectors
Superclasses: matlab.unittest.selectors.Selector
Select TestSuite array elements by test tag
Description
The matlab.unittest.selectors.HasTag class provides a selector for
filtering a test suite based on test tags.
In a class-based test, test tags are specified by the TestTags
class-level or method-level attribute of the corresponding TestCase class. For more information, see Tag Unit Tests.
Creation
Description
selector = matlab.unittest.selectors.HasTag creates a selector
that selects any tagged TestSuite array elements.
Input Arguments
Properties
Examples
Alternative Functionality
Use the HasTag class for maximum flexibility when filtering a test suite
based on test tags. Alternatively, you can create a filtered test suite using the
Tag name-value argument. For example:
filteredSuite = matlab.unittest.TestSuite.fromClass(?ExampleTest, ... "Tag","Unit");
You can also select and run tagged tests using the Tag name-value
argument of the runtests or runperf function. For example:
results = runtests("ExampleTest.m","Tag","Unit");
Version History
Introduced in R2015a