MATLAB xUnit Test Framework: How to Run Tests in a Package

To run all the test cases in a package, give the name of the package as an argument to runxunit. Note: Running tests in a package requires MATLAB R2009a or later.

For example, suppose you are distributing a set of MATLAB files called the "ABC Toolbox." Then you could put your tests inside a package called abc_tests and run them like this:

runxunit abc_tests
Test suite: abc_tests
Test suite location: Package
20-Feb-2014 19:59:08

Starting test run with 2 test cases.
..
PASSED in 0.001 seconds.

(Note that the initial "+" character in the name of the package folder on disk is not part of the package name.)

Or you could put your tests inside a subpackage called abc.tests and run them like this:

runxunit abc.tests
Test suite: abc.tests
Test suite location: Package
20-Feb-2014 19:59:08

Starting test run with 2 test cases.
..
PASSED in 0.001 seconds.

You should not use a generic top-level package name such "tests" because then your package might be unintentionally combined with packages with the same name created by other people.

Back to MATLAB xUnit Test Framework