doc matlab.unittest.TestResult
help matlab.unittest.TestResult
TestResult - Result of running a test suite
The matlab.unittest.TestResult class holds the information describing
the result of running a test suite using the matlab.unittest.TestRunner.
It contains information describing whether the test passed, failed,
or ran to completion as well as the duration of the tests.
TestResult arrays are created and returned by the test runner, and are
of the same size as the suite which was run.
TestResult properties:
Name - The name of the TestSuite for this result
Passed - Logical value showing if the test passed
Failed - Logical value showing if the test failed
Incomplete - Logical value showing if test did not run to completion
Duration - Time elapsed running test
Details - Structure containing custom data for this result
TestResult methods:
table - Convert TestResult object to table
assertSuccess - Assert test session runs without failure
Examples:
>> import matlab.unittest.TestSuite;
>> % Result display method provides a summary of the results
>> suite = TestSuite.fromClass(?SomeTestClass)
>> results = run(suite)
results =
1x16 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Details
Totals:
12 Passed, 4 Failed (rerun), 0 Incomplete.
5.5091 seconds testing time.
>>
>> % Rerun only the failed tests by clicking the "rerun" hyperlink
ans =
1x4 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Details
Test Suite Summary:
0 Passed, 4 Failed (rerun), 0 Incomplete.
1.2894 seconds testing time.
>> % Make the fix and rerun the failed tests
ans =
1x4 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Details
Test Suite Summary:
4 Passed, 0 Failed, 0 Incomplete.
1.1607 seconds testing time.
See also: TestSuite, TestRunner
Documentation for matlab.unittest.TestResult
doc matlab.unittest.TestResult