Main Content

Programmatically Access Test Diagnostics

If you run tests with the runtests function or the run method of TestSuite or TestCase, the test framework uses a DiagnosticsRecordingPlugin plugin that records diagnostics on test results.

After you run tests, you can access recorded diagnostics via the DiagnosticRecord field in the Details property on TestResult. For example, if your test results are stored in the variable results, find the recorded diagnostics for the second test in the suite by invoking records = result(2).Details.DiagnosticRecord.

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

By default, the DiagnosticsRecordingPlugin plugin records qualification failures and events logged at a Terse level. To configure the plugin to record passing diagnostics or other logged messages at different verbosity levels, configure an instance of DiagnosticsRecordingPlugin and add it to the test runner.

See Also

| |

Related Topics