Main Content

Programmatically Access Test Diagnostics

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

  • Run tests using the runtests function.

  • Run tests using the testrunner function with no input.

  • Run tests using the run method of the TestSuite or TestCase classes.

  • Run performance tests using the runperf function.

  • Run performance tests using the run method of the TimeExperiment class.

After you run tests, you can access recorded diagnostics using the DiagnosticRecord field in the Details property on the TestResult object. 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 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

Go to top of page