Main Content

setRoadRunnerScenarioVariable

Class: sltest.testmanager.TestIteration
Namespace: sltest.testmanager

Set RoadRunner scenario variable for test iteration

Since R2024a

Syntax

setRoadRunnerScenarioVariable(iterObj,varName,varValue)

Description

setRoadRunnerScenarioVariable(iterObj,varName,varValue) creates or overrides the RoadRunner scenario variable varName in the test iteration iterObj with the value varValue.

Input Arguments

expand all

Test iteration to which to apply the RoadRunner scenario variable, specified as a sltest.testmanager.TestIteration object.

Name of the RoadRunner scenario variable, specified as a string or character vector. Scenario variables are variables defined in the RoadRunner scenario.

Data Types: char | string

Value of the RoadRunner scenario variable, specified in the format determined by the RoadRunner variable type.

Examples

expand all

This example shows how to set a RoadRunner scenario variable. First, create a test file, test suite, and RoadRunner test case. Then, create an iteration called ti and set the RoadRunner scenario to myExampleScenario. Then, set the RoadRunner scenario variable Vehicle1_Initial_Speed to 15 and add the iteration speed15 to the test case.

tf = sltest.testmanager.TestFile("myTestFile");
ts = sltest.testmanager.TestSuite(tf,"myTestSuite");
tc = sltest.testmanager.TestCase(ts,"simulation",...
   "myTestCase",runOnPlatform="RoadRunner");

Then, create an iteration called ti and set the RoadRunner scenario to myExampleScenario. Then, set the RoadRunner scenario variable Vehicle1_Initial_Speed to 15 and add the iteration speed15 to the test case.

ti = sltest.testmanager.TestIteration;
setRoadRunnerScenario(ti,"myExampleScenario");
setRoadRunnerScenarioVariable(ti,"Vehicle1_Initial_Speed",15);
addIteration(tc,ti,"speed15");

Version History

Introduced in R2024a