matlab-xunit is a unit test framework for MATLAB code. matlab-xunit is designed to be easy to use for MATLAB users with a wide range of experience. Users can write tests using ordinary M-files that are very simple in structure.
To use MATLAB xUnit in MATLAB, add the "src" and "matlab-xunit" folders (directories) to the MATLAB path. See the MATLAB documentation for setting the search path. (The "tests" directory contains the framework's own self-tests, and the "architecture" directory contains information about the framework architecture; these directories are not needed for using xUnit.)
Quick Start: How to Write and Run Tests
How to Put Multiple Test Cases in One M-file
How to Run Tests in Specific Directories
How to Alter Your Tests for 2016b
How to Test Using a Floating-Point Tolerance
How to Run Tests Silently and Query the Results
How to Write Tests That Share Common Set-Up Code
How to Write xUnit-Style Tests by Subclassing TestCase
How xUnit Searches for Test Cases
Main test driver function:
Assertion functions you can use in your tests:
assertTrue
assertFalse
assertEqual
assertFilesEqual
assertElementsAlmostEqual
assertVectorsAlmostEqual
assertExceptionThrown
The key xUnit-style classes that make everything work:
TestComponent
TestSuite
TestCase
FunctionHandleTestCase
TestRunMonitor
TestRunLogger
CommandWindowTestRunDisplay
Portions copyright 2008-2010 The MathWorks, Inc.
Portions copyright 2011 Thomas Smith.
Portions copyright 2014 Paul Sexton.
Portions copyright 2015 Tessella Ltd.
Portions copyright 2016 GN ReSound.