Main Content

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.

Flowchart to describe workflow of test generation.

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 modelingSupported workflowRelated information
Use Requirements/Specification ModelGenerating 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.

StepsSupported workflowRelated information
Achieve model coverageGenerating 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 logicDetect 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
  • Perform standalone analysis of model components, such as atomic subsystems or models referenced via model blocks.

  • The test for the model component workflow from Simulink Test™ leverages the test capabilities of Simulink Design Verifier.

Achieve missing coverage
  • Top-off workflow is used to generate tests that fill coverage gaps achieved by the existing tests.

  • Achieve missing coverage workflow from Simulink Test leverages the test capabilities of Simulink Design Verifier.

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.

StepsSupported workflowRelated information
Achieve generated code coverage
  • Top-off workflow is used to generate tests that fill coverage gaps achieved by model-based tests.

  • Achieve missing coverage workflow from Simulink Test leverages the test capabilities of Simulink Design Verifier.

Generate Test Cases for Embedded Coder Generated Code
Back-to-back testingLog expected outputs for model coverage tests and export these tests to Simulink Test to achieve back-to-back testing.
Testing functions in codeGenerating tests for code functions corresponding to a subsystemGenerate 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:

ProductInteractionsRelated information
Simulink Coverage™
  • Coverage report for the generated tests

  • Filtering and justification of objectives

Simulink Test
  • Export generated tests to Simulink Test

  • Workflows that leverage test generation by using

    Simulink Test

    are:

    • Tests for model component

    • Add tests for missing coverage

Requirements Toolbox™Generating test cases for requirements table and linkingGenerate and Export Tests from Requirements Table Blocks

See Also

Topics