Is there a way to add coverage results using external tests to the coverage obtained with tests in Simulink Test?

1 view (last 30 days)
Is there a way to add coverage results using external tests to the coverage obtained with tests in Simulink Test? Or would these tests need to be imported into SL Test?
Could I measure the coverage of these external tests completely independently of SL Test both for model and generated code? Since SL Test is not a product requirement for SL Coverage, I would assume there is a way, but how would this be done?

Accepted Answer

Pat Canny
Pat Canny on 19 Jul 2021
You can work with coverage results collected using Simulink Test and results from another testing tool (which uses Simulink Coverage to measure test coverage). This should be done just using Simulink Coverage.
First, export the coverage results from Simulink Test using getCoverageResults. This will create a cvdata object.
You can combine the coverage results exported from Simulink Test with the coverage results from non-Simulink Test tests using the + operator, in addition to other operations (i.e., * for coverage intersection or – for coverage difference). For more than two simulations, you can perform these operations in a for loop.
One caveat is for results from a model reference hierarchy or model which calls external M functions. In that case, the non-Simulink Test results are going to be in a cv.cvdatagroup, but the exported results from Simulink Test will be array of cvdata. In this case, you will have to manually create cv.cvdatagroup from the latter.
In general, when working outside of Simulink Test, you need to ensure that they you are aggregating compatible items (e.g. not trying to sum cvdata for model1 with cvdata for model2).

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!