Main Content

sldvmergeharness

Merge test cases and initializations into one harness model

Description

example

status = sldvmergeharness(name, models, initialization_commands) collects the test data and initialization commands from each test harness model in models. The function saves the data and initialization commands in name, which is a handle to the new model.

If name does not exist, sldvmergeharness creates name as a copy of the first model in models. sldvmergeharness then merges the data from other models listed in models into this model. If you create name from a previous sldvmergeharness run, subsequent runs of sldvmergeharness for name maintains the structure and initialization from the earlier run. If name matches an existing Simulink® model, sldvmergeharness merges the test data from models into name.

sldvmergeharness assumes that name and the rest of the models in models have only one Signal Editor block on the top level. If a model in models has more than one Signal Editor block on the top level or its top-level Signal Editor block does not have the same number of signals as the top-level Signal Editor block in name, sldvmergeharness does not merge the model test data into name.

To combine the test cases that use different sets of parameter values, use sldvmergeharness with sldvgencov.

Note

sldvmergeharness replaces sldvharnessmerge.

Examples

collapse all

Analyze the sldvdemo_cruise_control model for decision objectives and full coverage, and then merge the two test harnesses.

Open the sldvdemo_cruise_control example model.

openExample('sldv/CruiseControlTestGenerationExample',...
'supportingFile', 'sldvdemo_cruise_control');
model = 'sldvdemo_cruise_control';
open_system(model)

Set the sldvoptions and collect decision coverage.

opts1 = sldvoptions;
opts1.Mode = 'TestGeneration';
opts1.ModelCoverageObjectives = 'Decision';
opts1.HarnessModelFileName = 'first_harness';
opts1.SaveHarnessModel = 'on';
sldvrun(model, opts1);

Set the sldvoptions and collect full coverage.

opts2 = sldvoptions;
opts2.Mode = 'TestGeneration';
opts2.ModelCoverageObjectives = 'ConditionDecision';
opts2.HarnessModelFileName = 'second_harness';
opts2.SaveHarnessModel = 'on';
sldvrun(model, opts2);

Merge the two harness files.

status = sldvmergeharness('new_harness_model', {'first_harness',...
		'second_harness'}); 

Input Arguments

collapse all

Name of the new harness model, which is stored in the default MATLAB® folder.

A cell array that represents harness model names.

A cell array of the same length as models. initialization_commands defines parameter settings for the test cases of each test harness model.

Output Arguments

collapse all

If the merge works, sldvmergeharness returns a status of 1. Otherwise, it returns 0.

Version History

Introduced in R2010b