Main Content

runTestSuite

Class: matlab.unittest.plugins.TestRunnerPlugin
Namespace: matlab.unittest.plugins

Extend running of TestSuite array

Description

runTestSuite(plugin,pluginData) extends the running of the portion of the TestSuite array that is passed to the test runner. The testing framework evaluates this method within the scope of the runSession method.

An example of running different test suite portions is when tests run in parallel (requires Parallel Computing Toolbox™). In this case, the testing framework divides the original test suite into separate groups and assigns them to workers on the current parallel pool. The framework evaluates runTestSuite as many times as the number of groups into which the entire TestSuite array is divided.

example

Input Arguments

expand all

Plugin, specified as a matlab.unittest.plugins.TestRunnerPlugin object.

TestSuite portion information, specified as a matlab.unittest.plugins.plugindata.TestSuiteRunPluginData object. The testing framework uses this information to describe the test content to the plugin.

Attributes

Accessprotected

To learn about attributes of methods, see Method Attributes.

Examples

expand all

Create a plugin and override the runTestSuite method to print information about the test suite at run time.

classdef ExamplePlugin < matlab.unittest.plugins.TestRunnerPlugin
    methods (Access=protected)
        function runTestSuite(plugin,pluginData)
            % Inspect pluginData to get TestSuite size and group
            groupNumber = pluginData.Group;
            totalGroups = pluginData.NumGroups;
            suiteSize = numel(pluginData.TestSuite);
            fprintf('### Running %d tests in group %d out of %d groups\n', ...
                suiteSize,groupNumber,totalGroups)
            
            % Invoke the superclass method
            runTestSuite@ ...
                matlab.unittest.plugins.TestRunnerPlugin(plugin,pluginData)
        end
    end
end

Version History

Introduced in R2014a