xUnit Test Framework

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.

Installation

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.)

Getting Started

Quick Start: How to Write and Run Tests

How to Put Multiple Test Cases in One M-file

How to Run a Specific Test

How to Run Tests in Specific Directories

How to Run Tests in a Package

How to Alter Your Tests for 2016b

Advanced Usage

How to Test Using a Floating-Point Tolerance

How to Test an Error Message

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

Key Functions and Classes

Main test driver function:

Assertion functions you can use in your tests:

The key xUnit-style classes that make everything work:

Release History

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.