Is there a way to use fatalAssert statements in CustomCriteria or Clean-Up Callbaks ?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Animesh
il 8 Mar 2023
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Outputs in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!