MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Test Runner Customization


Use a TestRunner object to customize the way the framework runs a test suite. With a
TestRunner object you can:


  • Produce no output in the command window using the withNoPlugins method.

  • Run tests in parallel using the runInParallel method.

  • Add plugins to the test runner using the addPlugin method.


For example,use test suite, suite, to create a silent test runner and run the tests with
the run method of TestRunner.

runner = matlab.unittest.TestRunner.withNoPlugins;
results = runner.run(suite);

Use plugins to customize the test runner further. For example, you can redirect output,
determine code coverage, or change how the test runner responds to warnings. For more
information, see “Add Plugin to Test Runner” on page 33-110 and the plugins classes.

See Also
matlab.unittest.TestCase | matlab.unittest.TestSuite |
matlab.unittest.constraints | matlab.unittest.diagnostics |
matlab.unittest.qualifications | matlab.unittest.selectors

Related Examples



  • “Run Tests for Various Workflows” on page 33-105

  • “Add Plugin to Test Runner” on page 33-110


33 Unit Testing

Free download pdf