Main Content

setRoadRunnerScenario

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

Set RoadRunner scenario for test iteration

Since R2024a

Syntax

setRoadRunnerScenario(iterObj,rrScenario)

Description

setRoadRunnerScenario(iterObj,rrScenario) sets the RoadRunner scenario rrScenario in the test iteration iterObj. If you use this method more than once in an iteration, only the last scenario executes when you run the test.

Input Arguments

expand all

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

RoadRunner scenario to apply to the test iteration, specified as a string or character vector.

Data Types: char | string

Examples

expand all

This example shows how to set the RoadRunner scenario in a test iteration. 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