Plugin to help validate diagnostic code
The DiagnosticsValidationPlugin creates a plugin to help validate diagnostic code.
The DiagnosticsValidationPlugin can be added to the TestRunner to confirm that user supplied diagnostics execute correctly. This is useful because most of the time tests should not encounter failure conditions. This results in diagnostic code which is not typically exercised. Therefore, if there is a programming error in this diagnostic code, it will not be evident until the test fails. However, at this point the diagnostics for that failure condition are lost due to the error in the diagnostic code.
Using this plugin results in the unconditional evaluation of the diagnostics supplied by the test writer when running tests regardless of whether the test passes or fails. This helps a test author confirm that all of their diagnostic code is free from programming errors.
The diagnostic analysis can reduce the test performance and can result in a very verbose text output when used. Be aware of these impacts before using this plugin for routine testing.
matlab.unittest.plugins.DiagnosticsValidationPlugin creates a plugin to help validate diagnostic code.
Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB® documentation.
import matlab.unittest.TestRunner; import matlab.unittest.TestSuite; import matlab.unittest.plugins.DiagnosticsValidationPlugin; % Create a TestSuite array suite = TestSuite.fromClass(?mypackage.MyTestClass); % Create a TestRunner with no plugins runner = TestRunner.withNoPlugins; % Add a new plugin to the TestRunner runner.addPlugin(DiagnosticsValidationPlugin); % Run the suite to see all user supplied diagnostic output result = runner.run(suite)