Is there a way to use fatalAssert statements in CustomCriteria or Clean-Up Callbaks ?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
I'm trying to somehow customize the execution of a testfile, meaning if a certain test case fails, then it shoul not go any further, for example if I get an error while setting up a power supply then there is no reason in continuing.
I was attempting to use the fatalAssertFail statement or something similar for this in the Custom Criteria section, but I get an error statment that fatalAssertions and Assumptions are not allowed.
I tried experimenting with the code below in the Custom Criteria section of the Simulink Test Manager :
% no postprocessing
import matlab.unittest.TestCase;
import matlab.unittest.constraints.*
import matlab.unittest.qualifications.QualificationEventData
import matlab.unittest.qualifications.FatalAssertable
PSU = true;
test.fatalAssertReturnsTrue(PSU,'PSU passed')
The error code is :
-------------------------------------------------------------------- Fatal Assertion and Assumption qualifiers are not supported. Use Verification and Assertion. --------- Error ID: --------- MATLAB:unittest:FatalAssertable:FatalAssertionFailed -------------- Error Details: -------------- Fatal assertion failed.
How is the fatal Assert intended to be used ? Or what are the limitations ?
Thanks in advance
댓글 수: 0
채택된 답변
Animesh
2023년 3월 8일
Hello,
No, “fatalAssert” statements cannot be used in Custom Criteria or Clean-Up Call-backs in MATLAB. “fatalAssert” statements are intended to immediately terminate the test case execution upon failure and report the failure as a fatal error. This is not suitable for use in Custom Criteria or Clean-Up Call-backs, as they are not expected to terminate the test case execution.
Instead, you can use “assert” or “verify” statements with appropriate qualifiers in your Custom Criteria or Clean-Up Call-backs.
You can read more about “verify” here – https://www.mathworks.com/help/sltest/ref/verify.html
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Outputs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!