Package: matlab.unittest.selectors
Selector for TestSuite elements determined by tag
The HasTag
selector filters TestSuite
array elements
determined by the test element tag.
matlab.unittest.selectors.HasTag
constructs a selector for
TestSuite
elements determined by the test element tag. When you
instantiate HasTag
without input arguments, the resulting
TestSuite
array contains only elements with one or more tags.
matlab.unittest.selectors.HasTag(
constructs a selector for t
)TestSuite
elements determined by the test
element tag, t
. You can specify the tag as a character vector, a
string scalar, or an instance of the
matlab.unittest.constraints.Constraint
class. If the specified
tag, t
, is a character vector or string scalar, the testing framework
creates an IsEqualTo
constraint to select test elements with the tag
t
.
For a test element to be included in the suite, the test element must be tagged with the specified character vector or string scalar or with a value that satisfies the specified constraint.
Value. To learn how value classes affect copy operations, see Copying Objects.
Use the HasTag
selector for maximum flexibility to create test
suites from tags. Alternatively, at the time of test suite construction, you can filter
the test suite using the 'Tag'
name-value pair. For example:
s = TestSuite.fromClass(?ExampleTest,'Tag','Unit');
You can also select and run tagged tests using the 'Tag'
name-value
pair with the runtests
function. For example:
runtests('ExampleTest.m','Tag','Unit')
fromClass
| fromFile
| fromFolder
| fromMethod
| fromPackage
| matlab.unittest.selectors
| selectIf