How can I avoid false negative test results caused by a simulation stop time that was set too small to reach the end of the specified test sequence in R2022a?

4 visualizzazioni (ultimi 30 giorni)
We are using test harnesses with test sequences. When the simulation stop time is smaller than the time needed to execute all test sequence steps it is not indicated in the test result. This can easily lead to false negatives. 
Let's e.g. assume in the last test step there's a verify statement that would normally fail, but because the step is never reached a warning for the failed verification is not given. This situation is especially tricky when multiple scenarios with different runtimes are used. This requires always checking manually that the sim stop time is the max of all execution times of the scenarios.
How can this pitfall be avoided?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 21 Mar 2023
You can use a pattern as shown in the attached example CruiseControl_R2022a.slx.
(There's also a script that loads the necessary data during the model's PostLoadFcn callback, CruiseControl_dd.m.)
The model contains:
  • A test sequence harness
  • Test sequence block has a "Stop" boolean output set to true when the final test sequence step is executed.
  • The "Stop" signal is connected to a "Stop Simulation" block
  • The "Stop" signal is connected to a "Terminate Function" block
  • In the "Terminate Function" block, the "Stop" signal is connected to an "Assertion Block"
  • The assertion and test will fail in the Test Manager if the "stop" statement has not been executed
This way you can check that the end of the test sequence was actually reached during the test execution.

Più risposte (0)


Non è stata ancora inserito alcun tag.




Community Treasure Hunt

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

Start Hunting!

Translated by