matlab.unittest.selectors.HasTag class
Package: matlab.unittest.selectors
Select TestSuite
array elements by test tag
Description
The matlab.unittest.selectors.HasTag
class provides a selector for
filtering the test suite based on test tags.
Construction
selector = matlab.unittest.selectors.HasTag
creates a selector
that selects any tagged TestSuite
array elements.
selector = matlab.unittest.selectors.HasTag(
create a selector that selects tag
)TestSuite
array elements that have the
specified test tag. You can specify tag
as a string scalar,
character vector, or matlab.unittest.constraints.Constraint
object. If
tag
is a string scalar or character vector, then the testing
framework creates an IsEqualTo
constraint to select
Test
elements tagged with the specified value.
For a Test
element to be included in the filtered test suite, the
Test
element must be tagged with the specified string scalar or
character vector or with a value that satisfies the specified constraint.
Input Arguments
Properties
Copy Semantics
Value. To learn how value classes affect copy operations, see Copying Objects.
Examples
Alternatives
Use the HasTag
selector for maximum flexibility to create test suites
from tags. Alternatively, at the time of test suite creation, you can filter the test
suite using the Tag
name-value argument. For example:
s = matlab.unittest.TestSuite.fromClass(?ExampleTest,"Tag","Unit");
You also can select and run tagged tests using the Tag
name-value
argument with the runtests
function. For example:
runtests("ExampleTest.m","Tag","Unit");
Version History
Introduced in R2015a