sltest.testmanager.TestInput Class
Namespace: sltest.testmanager
Add or modify test input
Description
Instances of sltest.testmanager.TestInput
are sets of signal input data
that can be mapped to override the inputs in the system under test.
The sltest.testmanager.TestInput
class is a handle
class.
Creation
Description
creates a obj
= sltest.testmanager.TestCase.addInputsltest.testmanager.TestInput
object for a test case
object.
Properties
Active
— Enabled indicator
0
| 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.
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Data Types: logical
ExcelSpecifications
— Sheet and range information for Excel baseline file
1-by-N array
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 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:
|
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Data Types: array
FilePath
— File path
character vector
File path of the test input, returned as a character vector.
Example: 'C:\MATLAB\sltestExampleInputs.xlsx'
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: char
InputString
— Input
character vector
Input evaluated 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)'
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Name
— Test input name
character vector
Name of the test input, returned as a character vector.
Example: 'sltestExampleInputs.xlsx'
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: char
MappingMode
— Mode to map test input
0
| 1
| 2
| 3
| 4
Mode to map test input, returned as an integer corresponding to the mapping mode:
0
— Block name1
— Block path2
— Signal name3
— Port order (index)4
— Custom
For more information on mapping modes, see Map Root Inport Signal Data.
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
MappingStatus
— Input mapping status
character vector
Mapping 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.'
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: char
CustomFunction
— Custom mapping function name
character vector
Name of function used for custom mapping, specified as the comma-separated pair
consisting of 'customFunction'
and a character vector. If you use a
packaged function for custom mapping, specify the name as
+packageName/functionName
, and if the path has multiple layers, use
a plus sign with each layer above the function name (for example,
+folder/+packageName/functionName
). This argument is optional and
valid only when MappingMode
is set to 4
.
Example: 'CustomFunction','mapfcn'
Example: 'CustomFunction','+maps/mapfcn'
CompileModel
— Model compilation for mapping
true
(default) | false
Option to compile or not compile the model when performing input mapping, specified
as the comma-separated pair consisting of 'CompileModel'
and
false
or true
.
Example: 'CompileModel',false
Methods
Public Methods
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 |
Examples
Add Microsoft® Excel® Data as Input
This example shows how to add data from a Microsoft® Excel® spreadsheet and map it to a test case. Only the two sheets that have data are added and mapped.
Load the Example Model
open_system('slexAutotransRootInportsExample');
Create a New Test File
tf = sltest.testmanager.TestFile('input_test_file.mldatx');
Get the Test Suite and Test Case Objects
ts = getTestSuites(tf); tc = getTestCases(ts);
Add the Example Model as the System Under Test
setProperty(tc,'Model','slexAutotransRootInportsExample');
Add Excel® Data to Inputs Section and Specify Sheets to Add
excelfile = 'sltestExampleInputs.xlsx'; input = addInput(tc,excelfile,'Sheets',["Acceleration","Braking"]);
Use Default Mapping Mode to Map the Input Signals for the Sheets
map(input(1)); map(input(2));
Version History
Introduced in R2015b
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)