Main Content

reportFinalizedSuite

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

Extend reporting of finalized TestSuite array

Description

reportFinalizedSuite(plugin,pluginData) extends the reporting of a finalized portion of the original test suite. A test suite portion is finalized when it is no longer possible for any qualifications to modify the results associated with its elements. The testing framework evaluates this method as many times as the number of groups into which the entire TestSuite array is divided.

An example of reporting test results for finalized test suite portions is when tests run in parallel (requires Parallel Computing Toolbox™). In this case, the testing framework divides the original TestSuite array into separate groups and assigns them to workers on the current parallel pool. A plugin that overrides the reportFinalizedSuite method can report test group results as soon as they are finalized by a worker, rather than waiting until the entire test suite is complete.

example

Input Arguments

expand all

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

Finalized test suite portion information, specified as a matlab.unittest.plugins.plugindata.FinalizedSuitePluginData 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 reportFinalizedSuite method to display a summary for a group of tests once the group is finalized.

classdef ExamplePlugin < matlab.unittest.plugins.TestRunnerPlugin
    methods (Access=protected)
        function reportFinalizedSuite(plugin,pluginData)
            % Inspect pluginData to get finalized TestSuite information
            groupNumber = pluginData.Group;
            totalGroups = pluginData.NumGroups;
            suiteSize = numel(pluginData.TestSuite);
            fprintf('### Finished Running %d tests in group %d out of %d groups\n', ...
                suiteSize,groupNumber,totalGroups)

            % Invoke the superclass method
            reportFinalizedSuite@ ...
                matlab.unittest.plugins.TestRunnerPlugin(plugin,pluginData)
        end
    end
end

Version History

Introduced in R2019b