Main Content

runSession

类: matlab.unittest.plugins.TestRunnerPlugin
命名空间: matlab.unittest.plugins

扩展测试会话的运行

自 R2019b 起

说明

示例

在测试会话中,runSession(plugin,pluginData) 对测试框架传递给测试运行器的原始 TestSuite 数组的运行进行扩展。该框架对整个 TestSuite 数组计算一次此方法。

输入参数

全部展开

插件,指定为 matlab.unittest.plugins.TestRunnerPlugin 对象。

整个测试套件的信息,指定为 matlab.unittest.plugins.plugindata.RunPluginData 对象。测试框架使用此信息来描述该插件的测试内容。

属性

Accessprotected

要了解方法的属性,请参阅方法属性

示例

全部展开

创建一个插件并覆盖 runSession 方法,以显示整个 TestSuite 数组中的元素数。

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

版本历史记录

在 R2019b 中推出