Unit testing Stateflow charts

3 views (last 30 days)
Garret Fick
Garret Fick on 18 Oct 2017
Commented: Garret Fick on 23 Jan 2018
I have a set of Stateflow Atomic Subcharts that we have developed. I would like to develop automated unit tests for these, but I cannot find any examples of how to implement these tests.
Can anyone point me to any examples of testing Stateflow charts?

Answers (1)

Julia Antoniou
Julia Antoniou on 25 Oct 2017
Hi Garret,
There is a tutorial in our documentation that explains how to generate reusable code from an atomic stateflow chart. You can then use this code for unit testing. See the following link for the tutorial: https://www.mathworks.com/help/stateflow/ug/tutorial-generating-reusable-code-for-unit-testing.html
Garret Fick
Garret Fick on 23 Jan 2018
I found it is possible to use Simulink Test to create tests and that has worked well for us.
The key is to create a Test Sequence, and then use that to send data into your model. If that isn't enough tips, reply and I'll fill in more details.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!