Main Content

runSession

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

Extend running of test session

Description

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

example

Input Arguments

expand all

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

Entire test suite information, specified as a matlab.unittest.plugins.plugindata.RunPluginData 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 runSession method 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

Version History

Introduced in R2019b