In the last couple of weeks, we’ve started to set up a test suite for the DICOM toolkit DCMTK. In fact, this is something we were thinking about for more than 10 years now, but in the past we never found the time to really do that. There were already some test programs in the various DCMTK modules, e.g. in the “ofstd/tests” and “dcmdata/tests” sub-directories, but these were stand-alone command line programs that had to be invoked separately. Also the output of these programs was quite different and it was not always easy to assess whether the tests were performed successfully or not on a particular platform.
The idea behind the “new” approach is to have a general C++ testing framework for the entire toolkit. It is inspired by QuickTest, a simple framework that is totally contained within a single header file. The user can either start all tests in all modules, all tests in a particular module or specific tests only. The default output is something like the following:
Test results for module ‘ofstd’: 23 succeeded, 0 failed.
Test results for module ‘dcmdata’: 43 succeeded, 0 failed.
In verbose mode, details on the progress of the individual tests are output to the console. Of course, in case of error there will always be a message including the name of the failed test as well as the name of the source file and the line number where the error occurred.
In our internal development version, we have already converted all existing tests in the modules “ofstd” and “dcmdata” to the new testing framework. Our intention is to write a new test each time a bug is fixed or a new feature is added – at least when some lower level and, therefore, crucial parts of the code are affected. This will allow for performing some kind of automatic regressing testing in order to further enhance the quality of the DCMTK.
We hope that you’ll like this new way of testing 🙂
Update (2016-02-16)
The number of test cases increased over the last few years. We now have a total of 202 tests. Here is the output of “make check-exhaustive” (Autoconf) on my Linux machine:
Test results for module ‘ofstd’: 52 succeeded, 0 failed.
Test results for module ‘dcmdata’: 80 succeeded, 0 failed.
Test results for module ‘dcmiod’: 1 succeeded, 0 failed.
Test results for module ‘dcmseg’: 1 succeeded, 0 failed.
Test results for module ‘dcmnet’: 2 succeeded, 0 failed.
Test results for module ‘dcmsr’: 65 succeeded, 0 failed.
Test results for module ‘dcmrt’: 1 succeeded, 0 failed.
Here is the corresponding commit that adds the latest test case to the git repository.