UNIT TESTING FRAMEWORK FOR MATLAB

M. Kvasnica · 2005

In this work we present a new framework for unit testing of programs in MATLAB. The framework can be used if the Test Driven Development (TDD) approach is employed in the development process. The framework allows the user to write and execute test files, which verify correct behavior of the tested code. In the TDD approach, each test should verify only a small portion of certain tested function, hence the tests are referred to as unit tests. Due to that one usually has a large number of unit tests when developing complex programs. Our framework therefore offers a user-friendly way of creating and managing multiple tests. The user can choose whether to run the full pile of unit tests, or whether only a subset of tests should be executed. To reduce the number of tests which need to be performed, the toolbox automatically checks dependencies between modified code and individual test files and suggests a subset of tests which should be executed. The results of each test run can then be visualized either directly in MATLAB using a command-line or GUI interfaces, or the results can be exported via an XML file. The latter approach can be used to couple our framework with other systems which provide continuous code integration. We show how one of such systems, namely TRAC equipped with the BITTEN plugin, can be used to trigger execution of unit tests based on a code change in a common version control system, hence providing the developers with instant feedback about the impact of individual changes on the whole code base. Finally, we show on a concrete use case that the framework can significantly improve both the correctness and speed of the development process.

Read the paper · More papers on PaperTik