Main Content

reportFinalizedSuite

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

Extend reporting of finalized TestSuite array

Description

example

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.

Input Arguments

expand all

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

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

Examples

expand all

Override the reportFinalizedSuite method in the plugin class 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
Introduced in R2019b