Main Content

matlab.unittest.TestRunner.withNoPlugins

Class: matlab.unittest.TestRunner
Package: matlab.unittest

Create simplest runner possible

Syntax

runner = matlab.unittest.TestRunner.withNoPlugins

Description

runner = matlab.unittest.TestRunner.withNoPlugins creates a TestRunner that is guaranteed to have no plugins installed and returns it in runner. It is the method one can use to create the simplest runner possible without violating the guarantees a test writer has when writing TestCase classes. This runner is a silent runner, meaning that regardless of passing or failing tests, this runner produces no command window output, although the results returned after running a test suite are accurate.

This method can also be used when it is desirable to have complete control over which plugins are installed and in what order. It is the only method guaranteed to produce the minimal TestRunner with no plugins, so one can create it and add additional plugins as desired.

Output Arguments

runner

matlab.unittest.TestRunner object.

Attributes

Statictrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

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 a TestRunner object.

runner = TestRunner.withNoPlugins;

% Run the suite silently
result = run(runner,suite)

Using the TestRunner object created in the previous example, control which plugins are installed and in what order they are installed.

Add matlab.unittest class to the current import list.

import matlab.unittest.plugins;

Add specific plugins.

runner.addPlugin(DiagnosticsValidationPlugin);
runner.addPlugin(TestRunProgressPlugin.withVerbosity(2));

Rerun the tests.

result = run(runner,suite)