T =
5×6 table
Name Type TestDiagnostics FrameworkDiagnostics Stack Timestamp
_______________________ _________________ ______________________________ ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ____________ ____________________
'ExampleTest/testOne' 'Assertion' 'TestDiagnostics not provided' 'assertGreaterThan failed.↵--> The value must be greater than the minimum value.↵↵Actual Value:↵ 5↵Minimum Value (Exclusive):↵ 10' [1x1 struct] 17-Jul-2017 12:41:18
'ExampleTest/testTwo' 'Verification' 'Not Empty' 'verifyEmpty failed.↵--> The value must be empty.↵--> The value has a size of [1 5].↵↵Actual char:↵ wrong' [1x1 struct] 17-Jul-2017 12:41:18
'ExampleTest/testTwo' 'Verification' 'Not double' 'verifyClass failed.↵--> The value's class is incorrect.↵ ↵ Actual Class:↵ char↵ Expected Class:↵ double↵↵Actual char:↵ wrong' [1x1 struct] 17-Jul-2017 12:41:18
'ExampleTest/testThree' 'Assertion' 'Values not equal' 'assertEqual failed.↵--> The values are not equal using "isequaln".↵--> Failure table:↵ Actual Expected Error RelativeError ↵ ______ ________ _____ __________________↵ ↵ 14 13 1 0.0769230769230769↵↵Actual Value:↵ 14↵Expected Value:↵ 13' [1x1 struct] 17-Jul-2017 12:41:18
'ExampleTest/testFour' 'Fatal Assertion' 'TestDiagnostics not provided' 'fatalAssertEqual failed.↵--> The values are not equal using "isequaln".↵--> Failure table:↵ Actual Expected Error RelativeError ↵ ______ ________ _____ __________________↵ ↵ 5 6 -1 -0.166666666666667↵↵Actual Value:↵ 5↵Expected Value:↵ 6' [1x1 struct] 17-Jul-2017 12:41:18
There are many options to archive or post-process this information. For example, you can
save the variable as a MAT-file or use writetable to write the table to various file types,
such as .txt, .csv, or .xls.
View the stack information for the third test failure
T.Stack(3)
ans =
struct with fields:
file: 'C:\Work\ExampleTest.m'
name: 'ExampleTest.testTwo'
line: 9
Display the diagnostics that the framework displayed for the fifth test failure.
celldisp(T.FrameworkDiagnostics(5))
ans{1} =
fatalAssertEqual failed.
--> The values are not equal using "isequaln".
--> Failure table:
Actual Expected Error RelativeError
______ ________ _____ __________________
5 6 -1 -0.166666666666667
Actual Value:
5
33 Unit Testing