Main Content

Programmatically Access Test Diagnostics

In certain cases, the testing framework uses a DiagnosticsRecordingPlugin instance to record diagnostics on test results. The framework uses the plugin by default if you take any of these actions:

After your tests run, you can access recorded diagnostics using the DiagnosticRecord field in the Details property of TestResult objects. For example, if your test results are stored in the variable results, then result(2).Details.DiagnosticRecord contains the recorded diagnostics for the second test in the suite.

The recorded diagnostics are DiagnosticRecord objects. To access particular types of test diagnostics for a test, use the selectFailed, selectPassed, selectIncomplete, and selectLogged methods of the DiagnosticRecord class.

By default, the plugin records failing events and events logged at the matlab.automation.Verbosity.Terse level. To record passing diagnostics or messages logged at higher verbosity levels, create an instance of DiagnosticsRecordingPlugin and add it to the test runner.

See Also

Classes

Topics