Automatic Unit Testing of SAS Programs with SASUnit
Software testing is indispensable but time-consuming. The concept of unit testing implies that testing should start as early as possible during software development and 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 in a fast and easy way.
This article presents a unit testing framework for SAS programs, SASUnit, available for free. SASUnit is used for the development, execution and documentation of tests for SAS programs. SASUnit test scenarios extend the specification of user requirements in a formal way and developers can leverage SASUnit for automatic and standardized documentation of test results.
In a SASUnit test scenario, you allocate static test data, call the program under test and then call assertion macros in order to compare actual with expected outcome. Comparison results are stored and used later to prepare the documentation.
Unit testing is widely used in software engineering in order to assure software quality in complex systems. When we standardize and reuse SAS programs and especially SAS macros, unit testing is badly needed and the SAS system lacks those capabilities.
That was why we at HMS Analytical Software developed SASUnit for use in our own projects. Our objective for putting it under the GPL license eventually was to encourage other SAS users to adopt and to improve it. SASUnit can be used to test SAS macros and SAS programs. Testing of Stored Processes and DI-jobs after code generation is also possible.
SASUnit is completely written in SAS base code with a few OS commands where necessary. At this time, SASUnit requires SAS 9.1.3 under Microsoft® Windows. We will port it to Unix (for sure) and mainframe (maybe).
Read more in the SASUnit paper, presented at PhUSE 2008 in Manchester. You will find more technical Details in the file readme.html. The complete Package with the SASUnit macros and many examples can be downloaded here.
Copyright 2008 by HMS Analytical Software GmbH, Heidelberg, Germany (http://www.analytical-software.de).
SASUnit licence:
The creators of this work hereby grant the permission to copy, distribute and/or modify this document under the terms of the GNU General Public License, either version 2 or any later version published by the Free Software Foundation.
This work is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) for more details.
SASUnit contains parts of Doxygen, siehe http://www.doxygen.org.
SAS is a registered trademark of SAS Institute, Cary, NC, USA.
- Anmelden oder Registrieren um Kommentare zu schreiben
