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?

2 次查看(过去 30 天)
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?

采纳的回答

MathWorks Support Team
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Inputs 的更多信息

标签

尚未输入任何标签。

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by