Unit test retrieve failed indexes

1 view (last 30 days)
Luis Ruiz
Luis Ruiz on 23 Jul 2020
I am using the unit test framework, when some of my tests fail I can see that matlab outputs the failed indeces.
I can see the output test results is in e.g., the variable
my_test_results.Details.DiagnosticRecord.Report:
Report: '================================================================================↵Verification failed in My test.↵↵ ----------------↵ Test Diagnostic:↵ ----------------↵ SIGNAL: not within error bounds↵↵ ---------------------↵ Framework Diagnostic:↵ ---------------------↵ verifyLessThanOrEqual failed.↵ --> Each element must be less than or equal to the maximum value.↵ ↵ Failing Indices:↵ 1198 10798 10799↵ ↵ Actual Value:↵ Array size ([3 5990]) exceeds the maximum number of displayable elements (5000). Displaying the first 100 elements:↵ ↵ Columns 1 through 49↵ ↵ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0↵ ↵ Columns 50 through 98↵ ↵ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0↵ ↵ Columns 99 through 100↵ ↵ 0 0↵ Maximum Value (Inclusive):↵ 1.000000000000000e-06↵↵ ------------------↵ Stack Information:↵ ------------------↵
As it can be seen, only three indeces failed. I already check the output plots and I think it is OK to pass this test. So my question is:
Can I retrieve the failed indexes as a vector numeric variable so I can evaluate this failure programatically, validate the failed indices and pass the test?

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!