Verify and Validate a Model and Code
This tutorial shows how to establish traceability for requirements-based model testing, check a model for compliance, measure test coverage, generate tests to increase coverage, and generate and test code. Verifying your model and code throughout development increases confidence that your implemented system meets design requirements and specifications.
Early in the development process, you can create a high-level system model to serve as a basis for more detailed models. You can link items in the model to system requirements to establish traceability, and then use the model as an executable specification. As you verify the model, you can check for standards compliance, design errors, and run simulations to demonstrate that the results match the expected output. You can author tests, perform coverage analysis to measure test completeness, and generate additional tests. Finally, you can validate requirements by connecting your system prototype to user interface or plant hardware and executing it.
You can also verify generated and handwritten code. You can check your code for standards compliance, design errors, and analyze code metrics. You can then create tests and measure code coverage to determine the extent that the code is tested. For generated code, you can run the same tests to verify your model to demonstrate code-model equivalence. Finally, you can add tests, refine the system, and refine requirements until the design is fully functional, demonstrates no unintended behavior, and is fully tested.
This image shows how you can use verification and validation techniques throughout your development process.
To verify and validate a model, follow these steps in the tutorial:
Test Model Against Requirements and Report Results (Requirements Toolbox)
Analyze Models for Standards Compliance and Design Errors (Requirements Toolbox)
Perform Functional Testing and Analyze Test Coverage (Requirements Toolbox)
Analyze Code and Perform Software-in-the-Loop Testing (Requirements Toolbox)