Test coverage report shows same condition with 2 different sets of coverage stats
2 views (last 30 days)
Show older comments
In the coverage report, it lists a condition under decisisions analyzed (example: if A > x) with the 2 possible outcomes true and false, with the totals for each true and false. However it then lists that identical condition a 2nd time with different totals for the outcomes again.
A visual example of the table that shows:
Decisions Analyzed:
What is the difference between the first set of 3 (labeled as 50% covered) and the second set of 230 (labeled as 100% covered)? This issue is present for every condition in my model. It is also what occurs for other coverage types, like MCDC. Here's an MCDC example:
Again, the top half is the identical text to the bottom half, but the bottom half shows 1 of the 3 rows red (so more coverage is complete) whereas the top half shows all 3 in red (missing more coverage). What is the difference between the halves?
Thank you.
Cody
2 Comments
Guilherme Costa Nascimento
on 9 Jul 2024
Hi Cody,
It's hard for me to figure out why this is happening without seeing the model. Could you share a screenshot of one element where the decision issue occurs?
In case you can't share your model, would you be able to share a simplified version that shows this issue?
Thanks,
Guilherme
Accepted Answer
Guilherme Costa Nascimento
on 10 Jul 2024
Hi Cody,
Thanks for sending the model. In Stateflow, if you do not specify the type of action for your code, it will be executed both in the "entry" and "during" actions. Because these two actions are treated separately by Stateflow semantics, they create two different decisions.
In the example you sent, the "entry" action is executed once so it will not achieve full coverage.
To get full coverage you would have to create additional test cases that make every decision and condition outcome both true and false at state entry. Alternatively, if you did not intend your code to run on entry, you can specify it to only run in the "during" action.
- Guilherme
More Answers (0)
See Also
Categories
Find more on Results, Reporting, and Test File Management 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!