Is there a way to use fatalAssert statements in CustomCriteria or Clean-Up Callbaks ?
1 次查看(过去 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!