Code covered by the BSD License  

Highlights from
MATLAB xUnit Test Framework

image thumbnail
from MATLAB xUnit Test Framework by Steve Eddins
MATLAB xUnit is a unit test framework for MATLAB code.

MATLAB xUnit Release History

MATLAB xUnit Release History

3.1 19-Nov-2010

  • Add -logfile option to runtests.
  • Allow test names to be passed to runtests as a cell array of strings.
  • Add test suite name and execution date to output of runtests.
  • Added warning message if function-handle-based test file has a setup function that returns more than one output argument.
  • Fix bug related to handling subfunction test files in packages.
  • Fix TestSuite.fromPackageName to find tests inside subpackages.
  • Correct text in exTestCaseSearching.m to show that test files and functions can begin or end with "test" or "Test".

3.0.2 30-Jul-2010

  • Fixed bug that caused TestCase subclasses in a test package to be executed twice in some versions of MATLAB.
  • Documented the out = runsuite(...) syntax.
  • Added home doc links to the various doc pages.

3.0.1 16-Jun-2010

Fixed handling of TestCase subclasses in a test package.

3.0 12-Jun-2010

  • Added capability to run tests stored inside packages.
  • runtests errors if no test cases are found instead of silently passing.
  • Accept function names that end in "test" or "Test" as test functions.
  • In assertElementsAlmostEqual and assertVectorsAlmostEqual, change the default floor_tol value to sqrt(eps) instead of eps. This makes the assertion a bit more forgiving when comparing numbers very close to 0.
  • Added -verbose option to runtests.
  • Fixed handling of message strings containing sprintf-style control characters in the assert*.m functions.

2.0.1 04-Aug-2009

Corrected errors in assertElementsAlmostEqual and assertVectorsAlmostEqual related to NaN and Inf inputs. assertElementsAlmostEqual now properly asserts when one input is finite and the other is infinite. assertVectorsAlmostEqual now asserts whenever any input element is NaN or infinite. The behavior of xunit.utils.compareFloats has been changed to match.

2.0 05-June-2009

  • The name of the package has been changed to "MATLAB xUnit Test Framework." The command-line test runner is now called runtests. The utilities package is now called xunit.utils. If you want to continue using the old command-line test runner (mtest) and utilities package (mtest.utils), then put the obsolete directory on the MATLAB path.
  • The assertion functions assertEqual, assertElementsAlmostEqual, and assertVectorsAlmostEqual now print more information about the input values in the case of an assertion failure.
  • A new assertion function, assertFilesEqual, has been added.
  • The command-line test runner, runtests, now supports multiple directory names.
  • The assertion function assertAlmostEqual has been deprecated. Use assertElementsAlmostEqual and assertVectorsAlmostEqual instead. If you want to continue using assertAlmostEqual, then put the obsolete directory on the MATLAB path.

1.1.3 20-May-2009

Remove the LICENSE.txt file because the open source BSD license is now supplied automatically by the MATLAB Central File Exchange. There are no functional changes in this version.

1.1.2 02-Apr-2009

This release fixes a bug with assertVectorsAlmostEqual when the caller provided a custom message. When the function errored out because the tolerance was exceeded, the function would issue a different error message than expected.

1.1.1 16-Mar-2009

This release fixes a problem when calling mtest with no input arguments. Previously, it was not limiting its test-case discovery to TestCase subclasses and ordinary M-files beginning with "test" or "Test" as documented.

This release also integrates the MTEST documentation with the MATLAB Help Browser.

1.1 11-Mar-2009

This release adds new tools for performing floating-point comparisons. Using the new assertion functions assertElementsAlmostEqual and assertVectorsAlmostEqual, you can perform both absolute and relative tolerance comparisons, either elementwise or in a vector L2-norm fashion.

The previous floating-point comparison function, assertAlmostEqual, is still available, but its use is discouraged.

1.0 30-Jan-2009

This release, the first to be posted on the MATLAB Central File Exchange, includes a refactoring of TestCase and TestSuite to use the composite design pattern. Both classes now subclass the abstract class TestComponent, and the individual items contained in a TestSuite object are TestComponent objects. That means a TestSuite object can contain both TestSuite objects and TestCase objects.

TestSuites are now built up hierarchically. All the test cases in a subfunction-based test M-file become a test suite, which in turn can be part of a test suite for an entire test directory.

The mtest driver function can now take the name of a directory, in which case it will automatically discover and run all the test cases in that directory.

The old TestRunObserver class has become the abstract TestRunMonitor class, with subclasses TestRunLogger and CommandWindowTestRunDisplay.

TestCaseInDir has been modified to do a directory change before executing the test case. The new class TestCaseWithAddPath makes a temporary path addition before executing the test case.

Subfunction-based test M-files written for one of the alpha versions of MTEST need to be revised so that the output variable name is "test_suite", and so that the first line of code calls the script "initTestSuite".

0.9 12-Sep-2008

This release is an extensive update that provides simpler ways of writing and running test cases.

  • The new function mtest automatically finds and runs all test cases in the current directory.
  • Test cases can be written as simple M-file functions.
  • Multiple test cases can be defined in a single M-file by using subfunctions.
  • Many new documentation examples have been provided, including a "Quick Start" example intended to enable users to write and run their first tests in just a few minutes.

0.8.1 17-Mar-2008

  • Some of the sample TestCase classes were missing classdef lines. FIXED
  • Now using dot method invocation syntax in examples and doc.
  • Minor edits to HTML doc (munit_doc.html).
  • Edited munit_doc.html by hand to clean up command-window links.

0.8 15-Mar-2008

  • Limited initial distribution for review and comment.

Contact us at files@mathworks.com