This new script shall facilitate the process of getting SASUnit running.
Prior to version 2.1 you had to update multiple files to get SASUnit running.
Now there is only one script that you need to adapt and this one creates all the start scripts that were formerly delivered with SASUnit.
Short video showing the setup process
The script that you formerly needed to adjust are no longer shipped with SASUnit.
Now you can use the new setup script.
You always have a triplet of files:
sasunit.setup.9.4.cmd: This is the core script file that will create all starting scripts.
sasunit.setup.9.4.en.cmd: Will create script files using english as SASUnit language.
sasunit.setup.9.4.de.cmd: Will create script files using german as SASUnit language.
This represents the script under WIndows
There is also a triplet with ending .sh for Linux environments.
And there still is a third triplet with asIs in the that uses the traditionell folderstructure
The ones mentioned above use the new folder structure we impemented.
We decided to rework the folder structure. Up to now the folder structure looks like this:
../example/doc/sasunit/en/doc/<HTML Report files>
/log/<log files of test scenarios>
<files of test data base>
<log file of SASUnit test suite>
The new structure is as follows:
../example/en/doc/<HTML Report files>
/logs/<log file of SASUnit test suite>
/scn_logs/<log files of test scenarios>
/testdb/<files of test data base>
This new folder structure was necessary to split content into etc, opt, var under linux.
So there was a need to separate things.
You can atke a look at the whole file in the repository.
Here I will outline the file sasunit.setup.9.4.cmd: * Check if a language was given and if not then use 'en' as language * Set environment variables for calling SAS * Set environment variables to configure SASUnit
Here is legal stuff and check for language parameter:
@echo off
REM This file is part of SASUnit, the Unit testing framework for SAS(R) programs.
REM For copyright information and terms of usage under the GPL license see included file readme.txt
REM or https://sourceforge.net/p/sasunit/wiki/readme/.
cd ..
if /i "%~1" == "" (SET SASUNIT_LANGUAGE=en) else (SET SASUNIT_LANGUAGE=%1)
These variables are needed to find and start SAS
REM --------------------------------------------------------------------------------
REM --- EnvVars for SAS Configuration ----------------------------------------------
SET SASUNIT_HOST_OS=windows
SET SASUNIT_HOST_ENCODING=PCOEM850
SET SASUNIT_SAS_VERSION=9.4
SET SASUNIT_SASPATH=C:\Program Files\SASHome\SASFoundation\%SASUNIT_SAS_VERSION%
SET SASUNIT_SAS_EXE=%SASUNIT_SASPATH%\sas.exe
SET SASUNIT_SAS_CFG=%SASUNIT_SASPATH%\nls\%SASUNIT_LANGUAGE%\sasv9.cfg
Now let's configure SASUnit
REM --------------------------------------------------------------------------------
REM --- EnvVars for SAS Unit Configuration -----------------------------------------
SET SASUNIT_ROOT=c:\projects\sasunit
SET SASUNIT_PROJECTROOT=c:\projects\sasunit\example
SET SASUNIT_TESTDB_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\testdb
SET SASUNIT_LOG_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\logs
SET SASUNIT_SCN_LOG_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\scn_logs
SET SASUNIT_REPORT_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\doc
SET SASUNIT_RUNALL=%SASUNIT_PROJECTROOT%\saspgm\run_all.sas
SET SASUNIT_LOG_LEVEL=INFO
SET SASUNIT_SCN_LOG_LEVEL=INFO
Print all variables with their values when running. Just to see what has been set.
echo.
echo --- EnvVars for SAS Configuration ----------------------------------------------
echo Operating system = %SASUNIT_HOST_OS%
echo Host OS encoding = %SASUNIT_HOST_ENCODING%
echo SAS Version = %SASUNIT_SAS_VERSION%
echo SAS Installation Path = %SASUNIT_SASPATH%
echo SAS Executable = %SASUNIT_SAS_EXE%
echo SAS Config File = %SASUNIT_SAS_CFG%
echo --- EnvVars for SAS Unit Configuration -----------------------------------------
echo SASUnit root path = %SASUNIT_ROOT%
echo Project root Path = %SASUNIT_PROJECTROOT%
echo Path to SASUnit test database = %SASUNIT_TESTDB_PATH%
echo Path to SASUnit log files = %SASUNIT_LOG_PATH%
echo Path to SASUnit scenario log files = %SASUNIT_SCN_LOG_PATH%
echo Path to SASUnit documentation = %SASUNIT_REPORT_PATH%
echo Name and path of run_all program = %SASUNIT_RUNALL%
echo Logging level for SASUnit Suite = %SASUNIT_LOG_LEVEL%
echo logging Level for Scenarios = %SASUNIT_SCN_LOG_LEVEL%
echo --------------------------------------------------------------------------------
echo.
Now use provided variables to call SAS with a program to create all script files
echo "Creating script files for starting SASUnit ..."
"%SASUNIT_SAS_EXE%" -CONFIG "%SASUNIT_SAS_CFG%" -no$syntaxcheck -noovp -nosplash
-log "bin/sasunit.setup.%SASUNIT_SAS_VERSION%.%SASUNIT_LANGUAGE%.log"
-sysin "%SASUNIT_ROOT%/saspgm/sasunit/runsasunitsetup.sas"
And at the end the obligatory error check
if %ERRORLEVEL%==0 goto normalexit
@echo.
@echo Exit code: %ERRORLEVEL%
@echo.
if %ERRORLEVEL%==1 @echo SAS ended with warnings. Review run_all.log for details.
if %ERRORLEVEL%==2 @echo SAS ended with errors! Check run_all.log for details!
@echo.
pause
:normalexit
You need to change where SAS is located (change values in bold):
REM --------------------------------------------------------------------------------
REM --- EnvVars for SAS Configuration ----------------------------------------------
SET SASUNIT_HOST_OS=windows
SET SASUNIT_HOST_ENCODING=PCOEM850
SET SASUNIT_SAS_VERSION=9.4
SET SASUNIT_SASPATH=C:\Program Files\SASHome\SASFoundation\%SASUNIT_SAS_VERSION%
SET SASUNIT_SAS_EXE=%SASUNIT_SASPATH%\sas.exe
SET SASUNIT_SAS_CFG=%SASUNIT_SASPATH%\nls\%SASUNIT_LANGUAGE%\sasv9.cfg
Then you need to adjust you SASUnit setup (change values in bold):
REM --------------------------------------------------------------------------------
REM --- EnvVars for SAS Unit Configuration -----------------------------------------
SET SASUNIT_ROOT=c:\projects\sasunit
SET SASUNIT_PROJECTROOT=c:\projects\sasunit\example
SET SASUNIT_TESTDB_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\testdb
SET SASUNIT_LOG_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\logs
SET SASUNIT_SCN_LOG_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\scn_logs
SET SASUNIT_REPORT_PATH=%SASUNIT_PROJECTROOT%\%SASUNIT_LANGUAGE%\doc
SET SASUNIT_RUNALL=%SASUNIT_PROJECTROOT%\saspgm\run_all.sas
SET SASUNIT_LOG_LEVEL=INFO
SET SASUNIT_SCN_LOG_LEVEL=INFO
News: 2022/12/-release-21-is-alive
Documentation: How to and Best Practices