File Exchange

image thumbnail


version (489 KB) by Paul Sexton
xUnit for Matlab 4.1.0


Updated 13 Jun 2017

GitHub view license on GitHub

Editor's Note: This file was selected as MATLAB Central Pick of the Week

First off, if you're new to testing, you should probably just go use the UNITTEST framework included with R2013a and later. It will (hopefully) have better documentation and better support. On the other hand if you've got lots of existing xUnit tests, if you want to take advantage of the extra features of this framework, or if you just prefer to use open-sourced code, keep reading.

* Now that Steve Eddins is no longer updating his MATLAB xUnit test framework, this is its new home.
* Version 4.1.0 has been tested against every release from 2013b - 2016b, and is probably compatible with even older versions.
Highlights of release 4.0.0:

* "runtests" command renamed to "runxunit" so it can coexist peacefully with the unit testing framework added in R2013a.

* JUnit-style XML test reports for use with tools like Jenkins.

* Obsolete crap from the MTEST era removed.

* Semantic versioning and naming for everyone's sanity.

Highlights of release 4.1.0:

* Adds compatibility with 2016b.

Comments and Ratings (4)

Paul Sexton


Version 4.1.0 provides the patch promised in my previous comment.

Paul Sexton


* If you're using class-based testing (your tests have "< TestCase" on line 1) then you don't need to worry and can ignore the rest of this comment. Yay for classes!

* If you're using subfunction-based testing (your tests have "initTestSuite" on line 2) then 2016 will break your tests. You have a few options:

1: Don't ever upgrade from 2016a. No further action required.
2. Convert to using class-based tests.
3. Wait for a forthcoming xunit patch. Note that you will still have to alter your tests, due to the changes made in 2016b. It is not possible to make existing subfunction-based tests compatible with 2016b (or later) without modification.

Blaine Rister

Jay Jones

Awesome open unit testing framework! And actively maintained :)
A great solution for those projects still using Matlab < R2013


Version 4.0.0 is broken in R2016b, due to changes made to MATLAB by The Mathworks.
Version 4.1.0 heroically repairs the damage (nearly).

Adding screenshot.

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

Inspired by: xml_io_tools