In your working folder, create the file ExampleTest.m
containing
the following test class.
The verifyEqual
qualification in testOne
causes
a test failure. The qualifications in testOne
and testTwo
include
an instance of a matlab.unittest.diagnostics.StringDiagnostic
.
At the command prompt, create a test suite from the ExampleTest
class.
Create a test runner with no plugins. This code creates
a silent runner and provides you with complete control over the installed
plugins.
Create a DiagnosticsOutputPlugin
that explicitly
specifies that its output should go to the screen.
Add the plugin to the TestRunner
and
run the suite.
================================================================================
Verification failed in ExampleTest/testOne.
----------------
Test Diagnostic:
----------------
Testing 5==4
---------------------
Framework Diagnostic:
---------------------
verifyEqual failed.
--> The values are not equal using "isequaln".
--> Failure table:
Actual Expected Error RelativeError
______ ________ _____ _____________
5 4 1 0.25
Actual Value:
5
Expected Value:
4
------------------
Stack Information:
------------------
In C:\work\ExampleTest.m (ExampleTest.testOne) at 4
================================================================================
Failure Summary:
Name Failed Incomplete Reason(s)
==================================================================
ExampleTest/testOne X Failed by verification.
Only the test failures produce output to the screen.