This project includes tests which check that models and scripts run without errors and warnings. The main product feature used for testing is MATLAB Testing Frameworks. Specifically, class-based unit test is implemented for each component, BEV system model, and the project.
You can run tests interactively in MATLAB Editor. Open Test Browser to see pass/fail status of the tests as you run tests. Test Browser also lets you measure code coverage.
For MATLAB projects, you can also use MATLAB Test Manager to run tests and measure code coverage. (It requires the MATLAB Test license.) MATLAB Test Manager can find test files in the project and lets you run them all at once or individually.
Each unit test comes with a test runner script (*_runtests.m
).
You can use test runner scripts to run tests programmatically.
These test files are stored in the Test
folders.
Similar to the Test Browser, the test runner script runs tests
and reports pass/fail summary.
It also measures MATLAB Code coverage for files listed in
the test runner script and generates a coverage report.
Starting from R2023b, you can also run tests
with the new buildtool
command from MATLAB Build Tool.
MATLAB Build Tool supports not only unit test,
but also code coverage measurement,
code issues checking, custom tasks,
building task dependencies, and more.
Programmatic test execution in this project will eventually
be migrated to MATLAB Build Tool.
Code Analyzer app can identify issues in the code files. You can open the app by clicking Code Analyzer shortcut button in the Project Shortcuts tab.
For more information about testing, see the documentation linked below.
- Testing Framework
- MATLAB Build Tool
- Code Analyzer app
- Class-Based Unit Test
- Generate Code Coverage Report in HTML Format
Test files introduced above can be used locally in your machine where you run a test runner script in MATLAB. If you also have a remote repository server for source control (such as GitHub or GitLab), you can use the same test files to automatically test the project when you push local changes to the remote.
If your repository is a public repository in github.com, you can use MATLAB and other toolboxes for free in GitHub Actions Continuous Integration service. For more information, see the documentation linked below.
- Continuous Integration (CI)
- GitHub Actions (github.com)
- MATLAB Actions (github.com)
Go to README at the project top folder.
Copyright 2023-2024 The MathWorks, Inc.