MATLAB Testing CI
Use this skill to close the loop on MATLAB work.
Test Ladder
Start as small as possible, then broaden:
- Smoke script runs without error.
- One unit test checks a core numeric result.
- Project or folder tests pass with
runtests. - Simulink model simulates and logged signals are checked.
- CI workflow runs the same command.
MATLAB/Simulink Completion Rule
For MATLAB or Simulink engineering tasks, completion means the work has been self-checked after writing:
- Scripts/functions run without error.
- Simulink models load and update/compile without diagram errors.
- Simulations reach the requested stop time.
- Key logged signals are nonempty and finite.
- Generated figures/data/reports exist and are nonempty.
- If code generation or deployment is requested, generated code/project/binary artifacts are checked for existence and nonzero size.
- If any step cannot be completed, record the exact blocker, the command that failed, and the highest-value next action.
MATLAB Unit Test Pattern
Use:
results = runtests;
assertSuccess(results);
For scripts, add explicit assertions instead of only checking that MATLAB exits.
CI Pattern
For GitHub Actions, use MathWorks maintained actions:
matlab-actions/setup-matlab@v3matlab-actions/run-tests@v3matlab-actions/run-command@v3
Use self-hosted runners for private licenses, specialized toolboxes, hardware, or long simulations.
Artifact Requirements
Save:
- MATLAB command log.
- Test results or summary JSON.
- Figures, models, generated code, and reports.
- MATLAB release and toolbox inventory.
- Dataset or paper reproduction manifest.
Acceptance Report
End every task with:
- Command executed.
- Passed checks.
- Skipped checks and reason.
- Artifact folder.
- Next highest-value regression test.