メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

getCoverageResults

クラス: sltest.testmanager.TestCaseResult
名前空間: sltest.testmanager

カバレッジ結果を取得

構文

covResult = getCoverageResults(result)
covResult = getCoverageResults(result,model)

説明

covResult = getCoverageResults(result) は、テスト ケース結果オブジェクトに属するカバレッジ結果を取得します。

covResult = getCoverageResults(result,model) は、テスト ケース結果オブジェクトおよび指定されたモデルに属するカバレッジ結果を取得します。

入力引数

すべて展開する

カバレッジ結果を取得するテスト ケース結果。sltest.testmanager.TestCaseResult オブジェクトとして指定します。

カバレッジ結果のセット内のモデルの名前。文字ベクトルとして指定します。

出力引数

すべて展開する

テスト ケース結果に含まれているカバレッジ結果。cvdata オブジェクトの配列として返されます。cvdata オブジェクトの詳細については、cvdata (Simulink Coverage) を参照してください。

すべて展開する

% Open the model for this example
openExample('sldemo_autotrans');

% Create the test file, test suite, and test case structure
tf = sltest.testmanager.TestFile('API Test File');
ts = createTestSuite(tf,'API Test Suite');
tc = createTestCase(ts,'simulation','Coverage Test Case');

% Remove the default test suite
tsDel = getTestSuiteByName(tf,'New Test Suite 1');
remove(tsDel);

% Assign the system under test to the test case
setProperty(tc,'Model','sldemo_autotrans');

% Turn on coverage settings at test-file level
cov = getCoverageSettings(tf);
cov.RecordCoverage = true;

% Enable MCDC and signal range coverage metrics
cov.MetricSettings = 'mr';

% Run the test case and return an object with results data
rs = run(tf);

% Get the coverage results
cr = getCoverageResults(rs);

バージョン履歴

R2016a で導入