Skip to Main Content
This paper describes the basic mechanics of automated unit testing for a general scientific and engineering audience. Using MATLAB xUnit, a unit test framework for MATLAB, the paper illustrates how to write and run tests, construct test cases, organize test files, and deal with the special issue of floating-point representation and arithmetic. The paper discusses the framework's design and architecture, including how various xUnit principles have been implemented and how procedural test-writing has been accommodated. The paper concludes with a brief introduction to test-driven development.