Unit test retrieve failed indexes

조회 수: 1 (최근 30일)
Luis Ruiz
Luis Ruiz 2020년 7월 23일
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?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Write Unit Tests에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by