Workflow for Test Generation
One of the essential steps in the model verification and validation process is generating tests to comprehensively assess model behavior. This involves verifying that the model meets intended requirements and checking model coverage to identify any missing testing scenarios. Additionally, it includes reusing and extending model-based tests to achieve code coverage, ensuring that both model and code behaviors are consistent.
Simulink® Design Verifier™ provides a comprehensive support for achieving these steps through automatic test generation capability. The sections describe the three important activities in the model-based testing:
Requirements based testing
Achieve model coverage
Achieve generated code coverage
and highlights how Simulink Design Verifier test generation can help you achieve them.
Compatibility Consideration
For a model to generate tests by using Simulink
Design Verifier, it has to be compatible. An example of incompatibility is when the
solver step is set to variable size
. Check Model Compatibility includes capabilities where, a model is incompatible for generating tests. In
these cases, you have to use methods like block replacement to make the model
suitable for analysis. For more information, see Block Replacement Effects on Test Generation.
Requirements-Based Testing
Simulink Design Verifier supports generating tests for each rows in requirements table. User may also use specification models – which are designed by using standard Simulink or Stateflow® elements and custom conditions as testing targets. For more information on requirements based test generation, see Construct Specification Models by Using Requirements Table Blocks and Use Specification Models for Requirements-Based Testing.
Requirements modeling | Supported workflow | Related information |
Use Requirements/Specification Model | Generating and linking tests to requirements. | Generate and Export Tests from Requirements Table Blocks |
Use custom blocks or APIs to define intended requirements conditions as testing targets |
Analyze and Address Missing Model Coverage
Model coverage enables you to evaluate the impact of testing on the design model. It assists in identifying missing requirements and highlights the need to improve the test suite based on coverage metrics. Simulink Design Verifier offers workflows to enhance your test suite by generating tests for model coverage metrics, helping to detect unreachable parts of your design.
Steps | Supported workflow | Related information |
Achieve model coverage | Generating tests for condition/decision, MCDC, and relational boundary metrics. This metric is defined for model and C-code functions by using the model. | |
Identify unreachable logic | Detect unreachable logic specified through model coverage or custom conditions. This helps you to evaluate and justify any dead logic identified. | Dead Logic Detection |
Testing model components |
| |
Achieve missing coverage |
|
Analyze and Address Missing Code Coverage
The generated code from the model is utilized in subsequent software integration steps on the embedded platform. You can reuse model-level tests and measure code coverage. Simulink Design Verifier helps to generate tests to address any missing code coverage identified in the generated code. Additionally, Simulink Design Verifier supports logging the expected output' during model coverage test generation, enabling back-to-back testing of the model with the generated code in a software-in-loop environment.
Steps | Supported workflow | Related information |
Achieve generated code coverage |
| Generate Test Cases for Embedded Coder Generated Code |
Back-to-back testing | Log expected outputs for model coverage tests and export these tests to Simulink Test to achieve back-to-back testing. | |
Testing functions in code | Generating tests for code functions corresponding to a subsystem | Generate Test Cases for a Subsystem |
Cross Product Interactions
Simulink Design Verifier enhances model verification by automatically generating test cases, identifying design errors, and proving properties within Simulink models. It easily interacts with other products to provide a comprehensive testing framework. The table describes how Simulink Design Verifier interacts with other products:
Product | Interactions | Related information |
Simulink Coverage™ |
| |
Simulink Test |
|
|
Requirements Toolbox™ | Generating test cases for requirements table and linking | Generate and Export Tests from Requirements Table Blocks |