Main Content

getInputs

Class: sltest.testmanager.TestCase
Namespace: 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

This example shows how to get the test inputs to a test case.

Load the Example Model and Create a New Test File

open_system('slexAutotransRootInportsExample');
tf = sltest.testmanager.TestFile('input_test_file.mldatx');

Get the Test Suite and Test Case Objects

ts = getTestSuites(tf);
tc = getTestCases(ts);

Add the 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"]);

Map the Input Signal for the Sheets by Block Name

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: ''

Version History

Introduced in R2015b