This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

getInputs

Class: sltest.testmanager.TestCase
Package: sltest.testmanager

Get test case inputs

Syntax

inputs = getInputs(tc)
inputs = getInputs(tc,simulationIndex)

Description

inputs = getInputs(tc) gets the input sets in a test case and returns them as an array of test input objects, sltest.testmanager.TestInput.

inputs = getInputs(tc,simulationIndex) gets the input sets in a test case and returns them as an array of test input objects, sltest.testmanager.TestInput. If the test case is an equivalence test case, then specify the simulation index.

Input Arguments

expand all

Test case to get test inputs from, specified as an sltest.testmanager.TestCase object.

Simulation number that the parameter sets apply to, specified as 1 or 2. This setting applies to the simulation test case where there are two simulations. For baseline and simulation test cases, the default simulation index is 1.

Output Arguments

expand all

Test inputs that belong to the test case, returned as an array of sltest.testmanager.TestInput objects.

Examples

expand all

% 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
% The third sheet is empty and cannot be mapped
map(input(1),0);
map(input(2),0);

% Get and check the test inputs
inputsOut = getInputs(tc);
inputsOut.ExcelSpecifications
ans = 

  ExcelSpecifications with properties:

    Sheet: 'Acceleration'
    Range: ''


ans = 

  ExcelSpecifications with properties:

    Sheet: 'Braking'
    Range: ''

Introduced in R2015b