Main Content

setRoadRunnerVariable

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

(Not recommended) Create or override RoadRunner variable

Since R2023b

setRoadRunnerVariable is not recommended. Use setRoadRunnerScenarioVariable or setRoadRunnerCustomVariable instead. (since R2023b)

Syntax

setRoadRunnerVariable(iterObj,varType,varName,varValue)

Description

setRoadRunnerVariable(iterObj,varType,varName,varValue) creates or overrides the RoadRunner variable varName in the test case or test iteration iterObj with the value varValue. You can use this syntax at the command line or in a scripted iteration in the Test Manager.

Input Arguments

expand all

Test iteration of the RoadRunner variable to which you want to apply the override, specified as a sltest.testmanager.TestIteration object.

Type of RoadRunner variable, specified as "scenario" or "custom". Scenario variables are variables defined in the RoadRunner scenario. For custom variables, you use a scripted iteration to define the variable. You can use both scenario and custom variables in callbacks.

Name of the RoadRunner variable to override, specified as a string or character vector.

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

Examples

expand all

This example shows how to create and then change the value of a RoadRunner variable. First, create a test file, test suite, and RoadRunner test case. Then, create an iteration named speed50, add the iteration to the test case, and set the speed variable to 50. Finally, create another iteration named speed70, add the iteration to the test case, and set the speed variable to 70.

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

ti_1 = sltest.testmanager.TestIteration;
addIteration(tc,ti_1,"speed50");
setRoadRunnerVariable(ti_1,"scenario","speed",50);

ti_2 = sltest.testmanager.TestIteration;
addIteration(tc,ti_2,"speed70");
setRoadRunnerVariable(ti_2,"scenario","speed",70);

Version History

Introduced in R2023b

collapse all

R2024a: Not recommended

Use of setRoadRunnerVariable is not recommended. To set RoadRunner scenario variable values, use the setRoadRunnerScenarioVariable method. To set custom RoadRunner variable values, use the setRoadRunnerCustomVariable method. There are no plans to remove setRoadRunnerVariable.