What are the unit-testing frameworks for MATLAB out there, and how do they compare? How should I choose one for our project? What are their pros and cons?
The unit testing framework provides test tool authors the ability to extend test writing through custom constraints, diagnostics, fixtures, and plugins. For example, you can create a custom plugin and use it to extend the test runner when you run your script-based, function-based, or class-based unit tests.
Class-based unit tests give you access to the full unit testing framework functionality. For example, you can write parameterized tests, tag your tests, or use shared test fixtures. To get started, see Author Class-Based Unit Tests in MATLAB and Write Simple Test Case Using Classes.
Each target must have a framework, which is a set of folders and files that implement the basic structure of a target. MathWorks® code generation software uses this framework to recognize the target and to tailor the code generation process.
The R2013a release of MATLAB includes a fully featured unit test framework
I think the most popular framework for MATLAB is xUnit Test Framework available on File Exchange. Very flexible and well documented.
Some other unit-testing tools are listed here and here.
Another very recent and interesting File Exchange submission is Doctest. Not exactly unit-testing framework though, it works like doctest in Python. I haven't tried it yet, but looks very promising for simple tests embedded into function's help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With