Key Features

  • Test harness for subsystem or model testing
  • Test Sequence block for running tests and assessments
  • Pass-fail criteria, including tolerances, limits, and temporal conditions
  • Baseline, equivalence, back-to-back, and real-time testing
  • Setup and cleanup scripts for customizing test execution
  • Test Manager for authoring, executing, and organizing test cases and their results
  • Customizable report generation for documenting test outcomes

Create Test Harnesses

Simulink Test™ provides an integrated simulation test environment to exercise and evaluate Simulink® models and components using test harnesses. To create a test harness, you first select the component under test, which can be a subsystem or the entire model. All subsystem types are supported, including virtual, atomic, iterator, action, and conditionally executed systems. Next, you generate the harness, which can include test inputs defined by Simulink library source blocks.

A new Test Sequence block that provides state-based logic can also be used to create model inputs and assessments. You can optionally add a plant model and other model elements to the harness, as well as evaluation criteria. You can develop, refine, simulate, and debug a Simulink model or subsystem directly within the test harness.

Multiple test harnesses can be created for a Simulink model or component. Each harness remains synchronized with the defined component under test. You can make changes to the component under test either in the main model or in the test harness. The test harness contains a separate model workspace and configuration set. The configuration options for test harnesses support all stages of your model development lifecycle, from early prototypes through code generation.

A test harness used to isolate a subsystem for testing. Simulink blocks used for testing are added to the test harness, which enables the main model to remain pristine and free of testing elements.

Author Test Sequences and Assessments

Complementing its support for tests with time-series data, Simulink Test includes a new Test Sequence block to support step-based and temporal test sequences. This block provides an editor for authoring tests using a subset of MATLAB® language features, including temporal operators, signal generators, and conditional constructs.

For example, using the Test Sequence block you can create a test case for an automotive cruise control system that confirms the throttle disengages within 25 milliseconds after the driver presses the brake. The assessment is triggered by the driver braking, regardless of when it occurs in the simulation. Similarly, you can use the Test Sequence block to assess the speeds at which a car shifts between gears.

On an aircraft control system, you can use the Test Sequence block to test the control laws for an autopilot after the aircraft reaches a specified flight configuration. In these examples, the harness input and assessments are created in Test Sequence blocks using temporal or logic descriptions rather than time-series data, which enables you to create more sophisticated tests.

Test Sequence block used in a test harness to provide inputs to the component under test and assess the simulation outputs. The Test Sequence block provides tools for creating sophisticated test sequences and assessments.

Manage Test Plans and Test Execution

Simulink Test includes a test manager to author, execute, review, and organize tests and test suites. You can use it to:

  • Author tests using test case templates
  • Execute tests individually or in a batch, in normal simulation mode, software-in-the-loop (SIL) mode, processor-in-the-loop (PIL) mode, or real-time mode
  • Review high-level pass/fail outcomes and graphically inspect detailed test results
  • Organize and manage test cases and test results

A test case is a test specification, which includes the defined simulation inputs and the set of evaluation criteria. When Simulink Test is used with Simulink Requirements, a test case can be linked to requirements, enabling bidirectional traceability between tests and requirements. When you use Simulink Test with Simulink Real-Time, test cases for real-time testing can be authored and managed in Simulink Test.

Test cases are authored using one of the desktop simulation or real-time test templates provided to create a simulation, baseline, or equivalence test. Simulation tests check that a simulation runs without errors, including assertions defined by a test assessment block. Baseline tests compare the simulation output of a model to a defined set of expected output signals. Equivalence tests compare the simulation output of two simulations.

As part of your test plan, you can determine which collection of test cases will be executed. Upon execution, Simulink Test will inspect the simulation outcomes as defined in the test case to determine a pass/fail result.

As test cases are executed, the pass/fail status is displayed. Details of the simulation outcomes and test results can be further inspected, archived, and shared.

Templates for creating test cases: simulation, baseline, and equivalence tests.

Perform Functional and Back-to-Back Testing

With Simulink Test, you can perform functional testing at the subsystem or model level. To verify functional requirements, you can define assessments directly or base the assessments on comparisons with time-series data.

For functional or regression testing, you can use a baseline template to simulate your model and perform a comparison with expected outputs. The time-series expected outputs can be captured from a Simulink model, read from a MAT file, or imported from an Excel® file using MATLAB.

Using the equivalence template, test cases can be defined to compare the outcomes of two simulations. For example, results from a requirements model can be compared to simulation results generated from the component under test. For code generation workflows, the simulation output of a design model can be compared to the output produced by the generated code in back-to-back or in-the-loop testing. You can use either equivalence or baseline templates to author SIL and PIL tests. You can also create real-time tests that are executed using Simulink Real-Time.

Analyze and Share Test Results

Simulink Test provides tools to simplify the debugging and analysis of test results. Simulink Test graphically identifies signals that do not meet tolerance specifications. You can see, for example, exactly when simulation results begin to deviate from the specified expected results, and use this information to debug and fix your model. Within the test manager, you can examine the simulation outputs and logged signals along with the defined expected outputs and deviations. You can select absolute or relative tolerance to adjust the sensitivity of test results.

Simulink Test displays a summary and details of tests that have been executed. Each test result has a summary page that shows the simulation output, applicable baseline or equivalence comparisons, and the outcome of the test: passed, failed, or incomplete. You can share or archive test results. To share the results with others, you can export them to a file, which can be reviewed later in the test manager. To archive the results in a document, you generate a report, which can include the test outcome, test summary, and any criteria used for test comparisons. Standard reports can be generated in HTML, PDF, and DOCX formats or customized using Simulink Report Generator.