Package: sltest.testmanager
Superclasses:
Add or modify test input
Instances of sltest.testmanager.TestInput
are
sets of signal input data that can be mapped to override the inputs
in the System Under Test.
creates
a obj
= sltest.testmanager.TestCase.addInputsltest.testmanager.TestInput
object for a test
case object.
Active
— Enabled indicator0
| 1
Indicates if the input is set to override in
the test case, 0
if it is not
enabled, and 1
if it is
enabled.
ExcelSpecifications
— Sheet and range information for Excel baseline fileThis property is read-only.
Sheet and range information for Microsoft®
Excel® baseline file, returned as a 1-by-N array, where each row has a
Sheet
and Range
value. Specify
Range
as shown in the table.
Ways to specify Range
| Description |
---|---|
Rectangular Range |
Specify the range using the syntax
Example:
|
Unspecified or Empty | If unspecified, the importing function automatically detects the used range. Example:
Note: Used Range refers to the rectangular portion of the spreadsheet that actually contains data. The importing function automatically detects the used range by trimming leading and trailing rows and columns that do not contain data. Text that is only white space is considered data and is captured within the used range. |
Row Range | You can identify the range by specifying the beginning and
ending rows using Excel row designators. Then Example:
|
Column Range | You can identify the range by specifying the beginning and
ending columns using Excel column designators. Then
Example:
|
Excel’s Named Range |
In Excel, you can create names to identify ranges in the
spreadsheet. For instance, you can select a rectangular portion
of the spreadsheet and call it Example:
|
FilePath
— File pathFile path of the test input, returned as a character vector.
Example: 'C:\MATLAB\sltestExampleInputs.xlsx'
InputString
— InputEvaluated during test case execution in the
LoadExternalInput
configuration
parameter of the System Under Test, specified as a
character vector.
Example: 'Acceleration.getElement(1),Acceleration.getElement(2)'
Name
— Test input nameName of the test input, returned as a character vector.
Example: 'sltestExampleInputs.xlsx'
MappingStatus
— Input mapping statusMapping status to indicate if the inport mapping was successful. For more information about troubleshooting the mapping status, see Understand Mapping Results.
Example: 'Successfully mapped
inputs.'
addExcelSpecification | Add a Microsoft Excel sheet to baseline criteria or test case inputs |
map | Map test input to system under test |
remove | Remove test input |
You can add data from a Microsoft Excel spreadsheet. The spreadsheet used in this example is located in the example folder.
% Load example model open_system('sltestExcelExample'); % Create new test file tf = sltest.testmanager.TestFile('C:\MATLAB\input_test_file.mldatx'); % Get test suite object ts = getTestSuites(tf); % Get test case object tc = getTestCases(ts); % Add the example model as the system under test setProperty(tc,'Model','sltestExcelExample'); % Add Excel data to Inputs section % Specify two sheets to add: Acceleration and Braking input_path = fullfile(matlabroot,'toolbox','simulinktest',... 'simulinktestdemos','sltestExampleInputs.xlsx'); input = addInput(tc,input_path,'Sheets',["Acceleration","Braking"]); % Map the input signal for the sheets by block name map(input(1),0); map(input(2),0);