This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab.unittest.Test class

Package: matlab.unittest
Superclasses: matlab.unittest.TestSuite

Specification of a single test method


The matlab.unittest.Test class holds the information needed for the TestRunner object to be able to run a single Test method of a TestCase class. A scalar Test instance is the fundamental element contained in TestSuite arrays. A simple array of Test instances is a commonly used form of a TestSuite array.



Name of the Test element.


Name of the test procedure that runs for the Test. In a class-based test, the ProcedureName is the name of the test method. In a function-based, test it is the name of the local function that contains the test. In a script-based test, it is a name generated from the test section title. Unlike the Name property, ProcedureName does not include any class or package name or information about parameterization.


Name f the test class for the TestCase. If a Test element is not a class-based test, then TestClass is an empty string.


Name of the folder that contains the file defining the test content. For tests defined in packages, the base folder is the parent of the top-level package folder.


Row vector of parameters required for the Test. The Parameterization property contains all the parameterized data needed by the TestRunner.


Row vector of fixtures required for the Test. The SharedTestFixtures property contains all the fixtures specified by the SharedTestFixtures class-level attribute of the TestCase class.


Cell array of tags applied to the test element.


collapse all

Create a suite of Test objects of all test methods in the BankAccountTest class.

import matlab.unittest.TestSuite;
suite = TestSuite.fromClass(?BankAccountTest); 

whos suite
  Name       Size            Bytes  Class                   Attributes

  suite      1x5              1636  matlab.unittest.Test 

Each test is a matlab.unittest.Test object.

Display test method names.

ans =