Develop, manage, and execute simulation-based tests
Simulink Test™ provides tools for authoring, managing, and executing systematic, simulation-based tests of models, generated code, and simulated or physical hardware. It includes simulation, baseline, and equivalence test templates that let you perform functional, unit, regression, and back-to-back testing using software-in-the-loop (SIL), processor-in-the-loop (PIL), and real-time hardware-in-the-loop (HIL) modes.
With Simulink Test you can create nonintrusive test harnesses to isolate the component under test. You can define requirements-based assessments using a text-based language, and specify test input, expected outputs, and tolerances in a variety of formats, including Microsoft® Excel®. Simulink Test includes a Test Sequence block that lets you construct complex test sequences and assessments, and a test manager for managing and executing tests. Observer blocks let you access any signal in the design without changing the model or the model interface. Large sets of tests can be organized and executed in parallel or on continuous integration systems.
Regression, Back-to-Back, and Requirements-Based Test Templates
Simulation tests verify that a simulation runs without errors, including assessments defined in the model. Baseline tests compare simulation output to a defined dataset. Equivalence tests compare the simulation output of two simulations.
Define Test Data Using Multiple Sources
Input data, expected outputs, and tolerances for test scenarios can be specified using MAT-files or Excel spreadsheets. You can:
- Author input data graphically using Signal Editor blocks.
- Define programmatic test input sequences using the Test Sequence block.
- Automatically generate test inputs using Simulink Design Verifier™.
Isolate Components for Testing with Test Harnesses
Test harnesses provide an integrated simulation environment that isolates the Simulink® model or model component. It separates the testing environment from the design. You can run test-specific simulations on models or model components while synchronizing design changes between the model and the test harness.
Temporal Assessments for Requirements Verification
Requirements for a design may include timing-dependent logic that is difficult to formalize in a test. You can author tests with temporal assessments with precise semantics in a natural language format that accurately models complex timing-dependent behavior with conditions, events, signal values, and delays.
Author Test Sequence and Assessments
You can author tests and assess simulation results with step-based and temporal test sequences using a subset of MATLAB® language features, including temporal operators, signal generators, and conditional constructs.
Observe Signals Without Changes to Model
With observers, you can debug and test Simulink signals without adding additional ports, blocks, connections, or interfaces that are only for testing. You can create a separate verification model to verify your system design.
The test manager helps you author, execute, review, and organize test cases and test suites. You can test your model in previous versions of MATLAB by selecting previous releases in the test case. To help you assess the extensiveness of your tests, collect coverage metrics.
Support for All Simulation Modes
Execute tests in normal simulation mode, accelerator mode, rapid accelerator model, software-in-the-loop (SIL) mode, processor-in-the-loop (PIL) mode, or real-time mode with Simulink Real-Time™.
Multiple Release Support
You can run test cases using multiple MATLAB releases, starting with R2011b, to allow you to execute your model in its production version but use the latest verification features of Simulink Test.
Measure Model and Code Coverage
Coverage metrics such as decision, condition, modified condition/decision coverage (MC/DC), and relational boundary coverage can be collected with Simulink Coverage™. From the coverage results in the test manager, you can generate test cases for missing coverage by using Simulink Design Verifier.
Visualize Test Results, Debug Errors, and Update Tests
Simulink Test graphically identifies signals that do not meet tolerance specifications and determines a pass/fail result. You can examine the simulation outputs and logged signals along with the defined expected outputs and update baseline data if deviations are acceptable.
Manage and Archive Test Results
Simulink Test displays a summary and details of tests that have been executed. A summary page for each test result shows the simulation output, baseline or equivalence comparisons, and the outcome of the test: passed, failed, or untested. To share the results with others, you can export test results 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™.
Test Scripts and Batch Workflows
Tests can be executed individually or in a batch to automate testing and set up a standardized testing environment. You can programmatically create a test case, specify test case criteria, run tests, and generate results.
You can run model tests using MATLAB Unit Test, allowing you to integrate within continuous integration (CI) systems such as Jenkins™. You can execute model tests together with MATLAB Unit Test scripts, functions, and classes.
Scale with Parallel Execution
For testing of large or complex Simulink models, you can speed up test execution and decrease the amount of time it takes to get test results by running tests in parallel. If you have Parallel Computing Toolbox™ then you can execute tests in parallel on your local machine. With MATLAB Parallel Server™, you can execute tests in parallel on a remote cluster, such as in the cloud.
Multiple Scenarios in Test Sequence block
Create and manage multiple test scenarios in a single Test Sequence block
Scale test execution by running tests in parallel on a cluster or in the cloud (requires MATLAB Parallel Server)
Test Failure Debugging using Model Slicer
Highlight model components that impact failed signals in a baseline test to debug test failures
Multi-release Equivalence Tests
Compare results of simulations on different MATLAB releases
MATLAB-based Simulink Test Authoring
Write baseline and equivalence tests for Simulink models in MATLAB test files
Reusable Library Subsystem SIL Testing
Verify generated code for a library subsystem
Use and create coverage filters from the Test Manager without rerunning simulations