matlab.unittest.TestRunner class

Package: matlab.unittest

Class for running tests in matlab.unittest framework


The matlab.unittest.TestRunner class is the fundamental API used to run a suite of tests in the matlab.unittest framework. It runs and operates on TestSuite arrays. Use this class to customize running tests.

The TestRunner class is a sealed class; you cannot derive classes from the TestRunner class.


To create a simple, silent TestRunner object, call the static withNoPlugins method.

runner = matlab.unittest.TestRunner.withNoPlugins

To create a TestRunner object to run tests from the MATLAB® Command Window , call the static withTextOutput method.

runner = matlab.unittest.TestRunner.withTextOutput

To create a customized TestRunner object, call the addPlugin method.

runner = TestRunner.withNoPlugins;


addPluginAdd plugin to TestRunner object
runRun all tests in TestSuite array
withNoPluginsCreate simplest runner possible
withTextOutputCreate TestRunner object for command window output


expand all

Create TestRunner Object Configured for Text Output

Add matlab.unittest classes to the current import list.

import matlab.unittest.TestRunner;
import matlab.unittest.TestSuite;

Create a TestSuite array.

suite = TestSuite.fromClass(?mypackage.MyTestClass);

Create the TestRunner object and run the suite.

runner = TestRunner.withTextOutput;
result = run(runner,suite);

See Also


Was this topic helpful?