runTestSuite

Class: matlab.unittest.plugins.TestRunnerPlugin
Package: matlab.unittest.plugins

Extend running of TestSuite array

Description

example

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

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.

Input Arguments

plugin

Plugin object, specified as an instance of the matlab.unittest.plugins.TestRunnerPlugin class.

pluginData

TestSuite portion information, specified as an instance of the matlab.unittest.plugins.plugindata.TestSuiteRunPluginData class. The testing framework uses this information to describe the test content to the plugin.

Examples

expand all

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

Introduced in R2014a