Fail Reasons exportable in the UnitTest-Framework?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
when I run unit tests with the unittest framework.
The result of a test run is a vector of matlab.unittest.TestResult objects.
The objects include an information, if a test fails, but do not contain the information about the failure.
If there is a failure, I want to give this failure information to another application.
Therefore my question: Are the fail reasons exportable in the UnitTest-Framework?
thanks
댓글 수: 2
Andy Campbell
2013년 12월 4일
When you say the fail reasons, do you mean the "Framework Diagnostics" and "Test Diagnostics"? Alternatively, do you mean the "Reason(s)" that are shown in the failure summary at the end of the run?
채택된 답변
Sean de Wolski
2014년 3월 11일
Now with R2014a, you can use custom test runner plugins such as the Failure Diagnostics Plugin and the Output Stream or To File plugin to gather the failure reasons and export them.
댓글 수: 0
추가 답변 (3개)
Swati Tiwari
2016년 3월 4일
Now with R2016a, you can use DiagnosticsRecordingPlugin to add diagnostics on test results.
If you run tests with the runtests function or the run method of TestSuite or TestCase, the test framework uses a DiagnosticsRecordingPlugin plugin that records diagnostics on test results.
After you run tests, you can access recorded diagnostics via the DiagnosticRecord field in the Details property on TestResult. For example, if your test results are stored in the variable results, find the recorded diagnostics for the second test in the suite by invoking records = result(2).Details.DiagnosticRecord.
댓글 수: 0
Andy Campbell
2013년 12월 18일
편집: Andy Campbell
2013년 12월 18일
This is related to your other question here. Basically, the core test result does not have any access or remember the reasons for the failure. Once you can extend the runner by implementing a custom plugin, that plugin can access such information. As mentioned in the linked answer though, this is not yet ready for prime time and is currently not a documented interface. It is very likely to change in a future release.
댓글 수: 0
per isakson
2014년 3월 10일
This line picks up most of the output from the test
msg_str = evalc('results = run( test_runner, test_suite );');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Testing Frameworks에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!