Check Test Coverage
Test coverage is how completely the model and generated code are tested. If you have Simulink® Coverage™, you can evaluate your test coverage by using test cases and test suites to exercise model components that correspond to the design requirements. If you have Requirements Toolbox™, you can trace coverage to specific requirements, and you can resolve coverage issues by explicitly excluding some requirements from needing tests. If you have Simulink Design Verifier™, you can create additional test inputs to exercise more of the model components.
Classes
sltest.testmanager.CoverageSettings | Modify coverage settings |
sltest.plugins.coverage.CoverageMetrics | Specify coverage metrics for tests run with MATLAB Unit Test framework |
sltest.testmanager.addTestsForMissingCoverage | Add tests to increase coverage (Since R2022a) |
sltest.testmanager.TestOptions | Options for adding test coverage (Since R2022a) |
Topics
- Collect Coverage in Tests
Use coverage measurement to assess the extent of your tests.
- Increase Coverage by Generating Test Inputs
Use Simulink Design Verifier to generate tests that extend coverage and recreate design errors, and add generated tests to your test file.
- Filter Test Execution, Results, and Coverage
Tag tests for selective test execution, and filter results and test coverage.
- Perform Functional Testing and Analyze Test Coverage
Analyze functional dependencies, test model components in isolation, create suites of test cases, test models, and code to achieve coverage.