runSession

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

Extend running of test session

Description

example

runSession(plugin,pluginData) extends the running of the original TestSuite array passed by the testing framework to the TestRunner within a test session. The framework evaluates this method one time for the entire TestSuite array.

Input Arguments

expand all

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

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

Examples

expand all

Override the runSession method in the plugin class to display the number of elements in the entire TestSuite array.

classdef ExamplePlugin < matlab.unittest.plugins.TestRunnerPlugin
    
    methods (Access = protected)
        function runSession(plugin, pluginData)
            
            % Inspect pluginData to get TestSuite size
            suiteSize = numel(pluginData.TestSuite);
            fprintf('### Running a total of %d tests\n', suiteSize)
            
            % Invoke the superclass method
            runSession@matlab.unittest.plugins.TestRunnerPlugin(plugin, pluginData);
        end
    end
    
end
Introduced in R2019b