testrunner
Syntax
Description
runner = testrunner
creates a default test runner, which is
equivalent to the runner that the testing framework configures by default when you call the
runtests
function.
The testrunner
function returns a matlab.unittest.TestRunner
object. You can call the methods on the returned
object to run and operate on your test suite and to customize running tests. For example, to
run a suite of tests, use run(runner,suite)
.
runner = testrunner("minimal")
creates a minimal runner with no
plugins installed. The returned test runner is the simplest runner possible and produces no
text output. Use this syntax when you want to have complete control over which plugins to
add to the runner.
runner = testrunner("textoutput")
creates a runner that is
configured for text output. The output produced includes test progress as well as
diagnostics in the event of test failures.
This syntax creates runners that tend to run tests more quickly, because the testing framework does not record diagnostics on test results produced by a nondefault runner. For more information, see Programmatically Access Test Diagnostics.
runner = testrunner(___,
specifies options using one or more name-value arguments in addition to any of the input
argument combinations in previous syntaxes. For example, Name=Value
)runner =
testrunner("textoutput",OutputDetail="Verbose")
creates a test runner that
displays test output detail at the maximum verbosity level. (since R2024b)
Examples
Name-Value Arguments
Tips
You can use the
testrunner
function instead of the static methods of thematlab.unittest.TestRunner
class. This table shows thetestrunner
function call equivalent to each static method of thematlab.unittest.TestRunner
class.testrunner
Functionmatlab.unittest.TestRunner
Classr = testrunner
r = matlab.unittest.TestRunner.withDefaultPlugins
r = testrunner("minimal")
r = matlab.unittest.TestRunner.withNoPlugins
r = testrunner("textoutput")
r = matlab.unittest.TestRunner.withTextOutput