Hi,
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?
Thanks

답변 (1개)

Julia Antoniou
Julia Antoniou 2017년 10월 25일

0 개 추천

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

댓글 수: 4

Garret Fick
Garret Fick 2017년 10월 26일
Thanks for pointing me to the tutorial. I have seen that one before, but it doesn't demonstrate testing of Atomic Subcharts within the MATLAB environment. Despite the name of the tutorial, that one simply shows how to generate code (presumably to test outside of Matlab).
Are there any other tutorials that demonstrate testing in the Matlab environment?
Julia Antoniou
Julia Antoniou 2017년 10월 27일
Hi Garret,
Yes, I see what you mean now. I am not sure we have an example specific to doing unit testing in MATLAB for Stateflow. However, I was able to find this documentation section on testing frameworks within the MATLAB environment. Using these frameworks, you could develop unit tests for your stateflow chart.
https://www.mathworks.com/help/matlab/matlab-unit-test-framework.html
The doc link below would be a good reference for how to programmatically interact with your stateflow chart:
https://www.mathworks.com/help/stateflow/programmatic-manipulation.html
Abhishek Ballaney
Abhishek Ballaney 2018년 1월 23일
Hi Julia,
In this case, how do we convert a state chart to MATLAB code (.m file)? Please guide.
Garret Fick
Garret Fick 2018년 1월 23일
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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Stateflow에 대해 자세히 알아보기

태그

질문:

2017년 10월 18일

댓글:

2018년 1월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by