Main Content

Create and Run a RoadRunner Test Case

You can use the Test Manager or Simulink® Test™ API commands to create and run RoadRunner test cases. RoadRunner is a tool for automating testing of different types of agents on ego vehicles in road scenarios simulations.

Note

To run a RoadRunner test case, you must have a RoadRunner license and a RoadRunner Scenario license.

Setup RoadRunner and Simulink Model

Before you can use the Simulink Test Test Manager or Simulink Test API commands to run a RoadRunner test case, set up your RoadRunner project and scenario using the RoadRunner application and verify that the scenario runs as expected in RoadRunner. See Simulate RoadRunner Scenarios with Actors Modeled in Simulink (Automated Driving Toolbox), RoadRunner Project and Scene System (RoadRunner), and Create Simple RoadRunner Scene (RoadRunner).

You must also develop and specify the Simulink model used as a behavior in RoadRunner. You use this model as the system under test in Simulink Test.

Use the Test Manager to Run a RoadRunner Test

  1. Use sltest.testmanager.view to open the Test Manager.

  2. Use New > Test File to create a test file.

  3. Use New > RoadRunner Test to create a RoadRunner test case template. The RoadRunner section of the test case opens.

    Roadrunner section of test case

    Set the simulation options and specify the folder and file locations.

    • Console Mode - When checked, the RoadRunner user interface is not displayed when the test runs.

    • Force Pacing Off — When checked, the RoadRunner simulation runs at its normal speed. When Force Pacing Off is not checked, you can tune the pace in the RoadRunner application to control the speed of the simulation.

    • RoadRunner Project Folder — Full path to RoadRunner project folder.

    • RoadRunner Installation Folder — Full path to RoadRunner executable folder

    • RoadRunner Scenario — Full path to RoadRunner scenario, which is usually in the project folder.

      Note

      You can test only one RoadRunner scenario for each test case. To test multiple scenarios, use separate test cases or test iterations.

  4. In the System Under Test section, enter the name of the Simulink model that you attached to the ego vehicle in the RoadRunner scenario. The folder for the model must be on the MATLAB® path.

  5. In the Iterations section, you can use Scripted Iterations to set model parameters or RoadRunner scenario variables.

    This example shows two scenario variables defined in RoadRunner.

    Variable in RoadRunner application

    In the Test Manager Scripted Iterations section, it shows how to set the values of the variables in two iterations and add the iterations to the test case.

    Iterations and scenario variables setup

    You can also define custom variables in Scripted Iterations and then use them in a callback.

    This example shows how to define a custom variable to use in two iterations, and then how to use a callback to print it.

    Scripted iterations with a custom variable

    Callback using custom variable

  6. In the Callbacks section, in addition to other variables, you can use these two RoadRunner-specific variables in RoadRunner test cases:

    • sltest_roadRunnerApp — RoadRunner application object

    • sltest_roadRunnerSim — RoadRunner simulation object

  7. Use other test case sections, as needed. All other test case sections work the same for RoadRunner tests and they do for other types of tests. See Specify Test Properties in the Test Manager.

  8. Click Run in the Test Manager to run the RoadRunner test. A RoadRunner session starts and runs the scenario simulation and the model. Depending on the Console Mode setting, the RoadRunner interface is displayed. When you run a RoadRunner test case or iteration, a RoadRunner application session opens and then closes when the test case or iteration is complete.

    The test uses the simulation mode that is set in the Simulink model. You cannot override the simulation mode for a RoadRunner test case in the Test Manager, however you can change the simulation mode for this model in Simulink.

  9. When the test finishes running, the Simulation Metadata in the Summary includes RoadRunner information.Simulation metatdata in Results Summary

  10. If desired, generate reports of the RoadRunner test specifications and test results.

Use Simulink Test API Commands to Create and Run a RoadRunner Test

For general information on using Simulink Test API commands a test script, see Create and Run Test Cases with Scripts.

  1. Use sltest.testmanager.TestFile to create a test file.

  2. Use sltest.testmanager.TestSuite to create a new test suite.

  3. Use createTestCase with the runOnPlatform="RoadRunner" input.

  4. Use these setProperty method name-value arguments to specify the RoadRunner options:

    • RoadRunnerRunInConsoleMode

    • RoadRunnerTurnOffPacing

    • RoadRunnerProjectFolder

    • RoadRunnerInstallationFolder

    • RoadRunnerScenarioPath

  5. Use the Model name-value argument of setProperty to assign the Simulink model as the System Under Test

  6. Use setRoadRunnerVariable to set the values for RoadRunner scenario variables or custom variables.

  7. Use sltest.testmanager.TestIteration to set up test iterations, if needed. You can define custom variables and set RoadRunner scenario variables in iterations and then use the variables in callbacks.

  8. Use the PreLoadCallback, PostLoadCallback, or CleanupCallback name-value arguments of the setProperty method to define callbacks for the test case, if needed.

  9. Run the test case.

  10. Use sltest.testmanager.TestResultReport to generate a results report

RoadRunner Test Case Limitations

  • Testing multiple Simulink agents is not supported.

  • Testing MATLAB agents is not supported.

  • You cannot convert between a regular test case and a RoadRunner test case.

  • Multiple release testing, parallel testing, and using the Model Slicer are not supported.

  • Fast restart is not supported in the Iterations section of the Test Manager.

See Also

| |

Related Topics