„At HMS, we find a solution for any challenge – not only for technical ones.“

David Schäfer , Project Manager, Senior Software Engineer

Unit Testing and Code Coverage Assessment with SASUnit

In order to assess the correctness of SAS macros, testing is indispensable. The concept of Unit Testing implies that tests themselves should be implemented as executable pieces of source code. As a result, tests can be repeated anytime, and negative side effects of software changes can be spotted easily. To check the correctness of SAS macros, all statements of a macro should be executed at least once during testing. This can be assessed with the Code Coverage measure, which describes the degree to which a macro has been tested.

This paper gives a general introduction as well as an update on recent developments on SASUnit; available for free from HMS Analytical Software GmbH. SASUnit is a unit testing framework for the development, execution and documentation of tests for SAS macros. A special focus of this paper is put on a new feature of SASUnit: the assessment of Code Coverage.


Dr. Patrick Warnat, computer scientist for medical informatics, senior software engineer and project manager at HMS Analytical Software.


Download complete paper.

Download SASUnit from SourceForge or join the development community.