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

1 次查看(过去 30 天)
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?

采纳的回答

Pat Canny
Pat Canny 2021-7-19
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).

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Analyze Coverage and View Results 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by