run

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

Run all tests in TestSuite array

Syntax

result = run(runner,suite)

Description

result = run(runner,suite) runs the TestSuite array defined by suite using the TestRunner object provided in runner, and returns the result in result.

This method runs all of the appropriate methods of the TestCase class to set up fixtures and run test content. It handles errors and qualification failures and records the information in result.

Input Arguments

runner

matlab.unittest.TestRunner object.

suite

Set of tests, specified as a matlab.unittest.TestSuite array.

Output Arguments

result

A matlab.unittest.TestResult object containing the result of the test run. result is the same size as suite and each element is the result of the corresponding element in suite.

Examples

expand all

Add matlab.unittest classes to the current import list.

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

Create a test suite, and a test runner that displays text.

suite = TestSuite.fromClass(?mypackage.MyTestClass);
runner = TestRunner.withTextOutput;

Run the test suite.

result = runner.run(suite)