getInputRuns

Class: sltest.testmanager.TestCaseResult, sltest.testmanager.TestIterationResult
Package: sltest.testmanager

Get inputs from simulations captured with the test result

Syntax

runArray = getInputRuns(result)

Description

runArray = getInputRuns(result) gets the simulation inputs from the test result.

Input Arguments

expand all

Test results to get simulation input results from, specified as a sltest.testmanager.TestCaseResult or sltest.testmanager.TestIterationResult object.

Output Arguments

expand all

Simulation run input results, returned as a Simulink.sdi.Run object array.

Examples

expand all

% Open the model
open_system('sltestExcelExample');

% Create test file and get test suite and test case objects
tf = sltest.testmanager.TestFile('Input Run Test File');
ts = getTestSuites(tf);
tc = getTestCases(ts);

% Add the model as the system under test, specify to save input runs
setProperty(tc,'Model','sltestExcelExample',...
    'SaveInputRunInTestResult',true);

% 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);

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

% Run the test case and return the results data
resultsObj = run(tc);

% Get test case result and iteration result
tcr = getTestCaseResults(resultsObj);
tir = tcr.getIterationResults;

% Get inputs from simulation run
inrun = tir(1).getInputRuns;
Introduced in R2017a