Main Content

runTestMethod

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

Extend running of single test method

Description

example

runTestMethod(plugin,pluginData) extends the running of a single test method. The testing framework evaluates this method within the scope of the runTest method of TestRunnerPlugin. It evaluates this method between setting up and tearing down the scalar TestSuite element (setupTestMethod and teardownTestMethod).

Input Arguments

plugin

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

pluginData

Test method 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

Print the time taken to evaluate the test method.

classdef ExamplePlugin < matlab.unittest.plugins.TestRunnerPlugin
    methods (Access = protected)
        function runTestMethod(plugin, pluginData)
            tic

            runTestMethod@matlab.unittest.plugins.TestRunnerPlugin(...
                plugin, pluginData);

            fprintf('### %s ran in %f seconds excluding fixture time.',...
                pluginData.Name, toc)
        end
    end
end
Introduced in R2014a