matlab.automation.diagnostics.Diagnostic Class
Namespace: matlab.automation.diagnostics
Fundamental interface for diagnostics
Renamed from matlab.unittest.diagnostics.Diagnostic
in R2023a
Description
The matlab.automation.diagnostics.Diagnostic
class provides an interface
that you can use to package diagnostic information. All diagnostics are derived from the
Diagnostic
class, whether they are user-supplied diagnostics or framework
diagnostics. Diagnostic
subclasses encode the diagnostic actions to be
performed and produce a diagnostic result that can be used by an automation framework, such as
the unit testing framework, and displayed as appropriate for that framework.
To create a custom diagnostic class:
Derive your class from
matlab.automation.diagnostics.Diagnostic
.Implement the
diagnose
method to encode the diagnostic actions to be performed.Set the
DiagnosticText
property within thediagnose
method to make information available to consumers of the diagnostic.
When used with the testing framework, any Diagnostic
implementation can be
used directly with the matlab.unittest.qualifications
qualification
methods, which perform the diagnostic actions and store the result to be used by the
framework. As a convenience, the framework creates appropriate Diagnostic
instances for user-supplied diagnostics that are string arrays, character arrays, or function
handles. To retain good performance, the framework converts these values to
Diagnostic
instances only when needed, typically in the event of a test
failure.
The matlab.automation.diagnostics.Diagnostic
class is a handle
class.