%% Display Test Results in Command Window
% Run a suite of tests with a runner that is configured for text output, and then access the results.
% Create a function-based test sampleTest.m in your current folder. The file contains two tests that pass and one test that intentionally fails.
% function tests = sampleTest
% tests = functiontests(localfunctions);
% end
%
% function testA(testCase)      % Test passes
% verifyEqual(testCase,2+3,5)
% end
%
% function testB(testCase)      % Test fails
% verifyGreaterThan(testCase,13,42)
% end
%
% function testC(testCase)      % Test passes
% verifySubstring(testCase,'hello, world','llo')
% end
% Create a test suite from the tests in sampleTest.m.

suite = testsuite('sampleTest');

% Create a runner that produces text output and use it to run the tests.

runner = testrunner('textoutput');
results = run(runner,suite);

% Display the results from the second test.

results(2)

% Check for diagnostics recorded on test results. If you were using a default runner, there would be a DiagnosticRecord field at this location. But because you are using a nondefault runner, the framework does not create such a field.

records = results(2).Details

% Copyright 2020 The MathWorks, Inc.