Unit tests with MATLAB.


Updated 8 Jun 2016

View License

This is an attempt to build a convenient unit test procedures for MATLAB files, following ideas of JUnit for Java, or CUnit.
Idea is create one test for each user function. This test calls user function, and assert some results. If the result does not correspond to the expected one, an 'assertion' is thrown.

At the end of the test, all wrong assertions are shown, and number of passed and failed tests is shown.

Then, if tests are correctly written, lanching the tests after modifications of user programs allows to check no bugs are added.

A (very) simple example is given in directory munit/demo.

Cite As

David Legland (2023). munit (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: MUnit: a unit testing framework in Matlab

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

update license