Unit testing/continuous integration with Simulink/Stateflow

后端 未结 8 1350
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 05:22

How can I perform unit testing in Simulink, or preferably, Stateflow?

I\'m a fan of agile software methods, including test driven development. I\'m responsible for the d

8条回答
  •  花落未央
    2021-02-01 05:44

    If your system is complex, you should decompose it using Model Reference and test each of these independently.

    An other solution (more "old school") is to put your main blocks in a library and to create small models.

    To test these submodels and especially those with a State Machine (Stateflow), the best is to create temporal test cases with the Signal builder block. You have a powerful function signalbuilder to interact with this block and load test cases. My method is to get for each case of each submodel an input file and an output file. Your outputs of the model are the "correct" output and the one from the blocks. The model is run with sim (no external inputs) and the 2 outputs are compared with a script the indicated which signal is different (and when).

    You could use an existent system but I prefer to use my own to run each case (or some of them).

    I don't have any public code for that but that's the way I use. I don't use a CIS so I can't answer the second part of your question.

提交回复
热议问题