Main Content

captureBaselineCriteria

Class: sltest.testmanager.TestCase
Namespace: sltest.testmanager

Capture baseline criteria and add to test case

Syntax

baseline = captureBaselineCriteria(tc,file,append)
baseline = captureBaselineCriteria(tc,file,append,Name,Value)

Description

baseline = captureBaselineCriteria(tc,file,append) runs the system under test and captures a baseline criteria set as a MAT-file, Simulation Data Inspector (SDI) MLDATX file, or Microsoft® Excel® file. The function returns a baseline criteria object, sltest.testmanager.BaselineCriteria. Use this function only if the test type is a baseline test case.

Note

If your model has multiple variant subsystems, capture independent baselines for each variant subsystem, instead of reusing a baseline.

baseline = captureBaselineCriteria(tc,file,append,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Input Arguments

expand all

Test case to capture baseline criteria in, specified as an sltest.testmanager.TestCase object.

File and pathname of the baseline criteria file, specified as a character vector. You can specify a MAT-file, Simulation Data Inspector MLDATX file, or a Microsoft Excel file.

Example: 'C:\MATLAB\baseline_API.mat'

Append baseline criteria if criteria already exists, specified as a Boolean. The Boolean true appends to existing criteria, and false replaces existing criteria.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Sheet','mysheet','Range','C1:F10'

Pairs for MAT-Files, Simulation Data Inspector (SDI) .mldatx file, and Microsoft Excel Files

expand all

Simulink release to capture the baseline data in, specified as a character vector or string array. Use a release specified in your preferences. For more information, see sltest.testmanager.getpref and sltest.testmanager.setpref.

Example: 'Release','R2017a'

Whether to capture baseline data for test case iterations, specified as a Boolean.

Example: 'CaptureForIterations',true

Pairs Only for Microsoft Excel Files

expand all

Name to sheet to capture baseline criteria to, specified as a character vector or string array.

Example: 'Sheet','testinputs'

Ranges of cells to capture baseline criteria to, specified as a character vector or string array. You can specify 'Range' only if you also specify 'Sheet'.

Example: 'Range','B2:C30'

Output Arguments

expand all

Baseline criteria added to the test case, returned as an sltest.testmanager.BaselineCriteria object.

Examples

expand all

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

% 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,'baseline','Baseline API 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_absbrake');

% Capture the baseline criteria
baseline = captureBaselineCriteria(tc,'baseline_API.mat',true);

Version History

Introduced in R2015b