MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Details: [1x1 struct]

Totals:
1 Passed, 0 Failed, 0 Incomplete.
1.8678 seconds testing time.

Create Table of Test Results

To access functionality available to tables, create one from the TestResult object.

rt = table(result)

rt=2×6 table
Name Passed Failed Incomplete Duration Details
__________________________________ ______ ______ __________ ________ ____________

'SolverTest/testRealSolution' true false false 1.8678 [1x1 struct]
'SolverTest/testImaginarySolution' true false false 0.053316 [1x1 struct]

Sort the test results by duration.

sortrows(rt,'Duration')

ans=2×6 table
Name Passed Failed Incomplete Duration Details
__________________________________ ______ ______ __________ ________ ____________

'SolverTest/testImaginarySolution' true false false 0.053316 [1x1 struct]
'SolverTest/testRealSolution' true false false 1.8678 [1x1 struct]

Export test results to a CSV file.

writetable(rt,'myTestResults.csv','QuoteStrings',true)

See Also


Related Examples



  • “Write Simple Test Case Using Classes” on page 33-51


33 Unit Testing

Free download pdf