Main Content

runTest

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

Extend running of single Test element

Description

runTest(plugin,pluginData) extends the running of a single Test element. runTest lets you override the method that runs a scalar Test element in the TestSuite array, including the creation of the TestCase instance, and the TestMethodSetup and TestMethodTeardown routines. Provided the testing framework completes all fixture setup, it invokes this method one time per Test element.

example

Input Arguments

expand all

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

Test element 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 runTest method to print the label of the Test element at run time.

classdef ExamplePlugin < matlab.unittest.plugins.TestRunnerPlugin
    methods (Access=protected)
        function runTest(plugin,pluginData)
            fprintf('### Running test: %s\n',pluginData.Name)
            runTest@ ...
                matlab.unittest.plugins.TestRunnerPlugin(plugin,pluginData)
        end
    end
end

Version History

Introduced in R2014a