Testcase for 100% Model Decision Coverage in Stateflow
20 views (last 30 days)
Show older comments
Hey all,
I am testing a Stateflow implementation and I have some issues in achieving 100% D1 in Model Coverage.
About the Model Coverage in Stateflow you can find Mathworks' description HERE . It is described that how Model Coverage Report is generated:
- How many times each exclusive substate is executed or exited from its parent superstate and entered due to parent superstate history;
- How many times each transition decision has been evaluated as true or false;
- How many times each condition has been evaluated as true or false.
As it can be observed in the attached screenshot from my report, testcases are able to enter each of the states. States' names are blurred (company policy) and anyway they do not help in answering of this question. : ) The problem appears due to the fact described in the first bullet point: substate exited when parent exits.
I have to say that the testcases, which were written for the state where I have 2/2, were reused for the other states.
I would like to ask for some instructions how to write a 'good' testcase which can validate the red lines.
Or is it a bug of Stateflow?
Any help / suggestion is welcomed.
Thanks, Ferenc
0 Comments
Accepted Answer
Arunkumar M
on 9 Nov 2018
First of all, I dont think it is a bug in Stateflow because I have performed coverage analysis and have successfully achieved 100% C1 and D1 coverage for many of my models.
- Without having a look at the structure of stateflow model it is difficult to say. Is it possible to provide an overview snapshot of statemachine without displaying details?
From your snapshot I could see that, substate exited when parent state exits is not getting satisfied. This could happen when you have used any empty transition (transition without any condition) or the transition condition is already satisfied which enables it to exit the state in one task cycle. Please note that, in each state, you have to stay atleast for more than 1 task cycle for achieving this coverage. Hope this helps.
0 Comments
More Answers (0)
See Also
Categories
Find more on Collect Coverage for Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!