フィルターのクリア

Model Coverage With sltest.TestCase

4 ビュー (過去 30 日間)
Taylor
Taylor 2024 年 3 月 31 日
回答済み: Taylor 2024 年 4 月 9 日
I'm having problems collecting model coverage with script based tests in sltest.testCase.
The test case isn't super important. Basically I'm playing data back through a model reference.
A test case as simple as this demonstrates the issue:
classdef TestHarnessWithModelCoverage_1 < sltest.TestCase
methods (Test)
function testOne(testCase)
in = testCase.createSimulationInput('MODEL_XXXX',...
'WithHarness','MODEL_XXXX_HARNESS');
simOut = testCase.simulate(in);
testCase.verifyTrue(true);
end
end
end
The test case fails on line 384 of ModelCoveragePlugin:
out.addResultsField('CoverageResults',plugin.CoverageSettings.save([]))
With the error:
Error using assert
Assertion failed.
Error in codeinstrum.internal.codecov.CodeCovData/setAggregatedTestInfo
Error in codeinstrum.internal.codecov.CodeCovData/setTestRunInfo
Error in codeinstrum.internal.codecov.CodeCovDataGroup/setTestRunInfo
Error in cvdata/set.testRunInfo
Error in stm.internal.Coverage.saveHelper
Error in stm.internal.Coverage/save
I'm using Matlab 2022b. Has anybody else run into this issue? I can collect coverage on the model when running the test case, but not through the sltest framework.

採用された回答

Taylor
Taylor 2024 年 4 月 9 日
There appears to be a bug in simulink 2022's model coverage plugin. The addResults field needs to be updated as follows.
out.addResultsField('CoverageResults',plugin.CoverageSettings.save(struct.empty))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResults, Reporting, and Test File Management についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by