HMS-Analytical-Software / SASUnit

SASUnit is a unit testing framework for SAS(TM)-programs. It can be used for the development, execution and automatic documentation of tests for SAS programs.
GNU Lesser General Public License v3.0
2 stars 0 forks source link

[Bug]: Check if all necessary folders are created by runsasunit #20

Open KLandwich opened 9 months ago

KLandwich commented 9 months ago

Contact Details

No response

What happened?

We have a different location for program installations and the projects with the SAS-Programms

Installation (disk d): sasunit

Project (disk f):

In sasunit.setup.9.4.cmd it is possible to set up this structure.

SET SASUNIT_TESTDB_PATH=%SASUNIT_PROJECTROOT%\sasunit_prj\%SASUNIT_LANGUAGE%\testdb SET SASUNIT_LOG_PATH=%SASUNIT_PROJECTROOT%\sasunit_prj\%SASUNIT_LANGUAGE%\logs SET SASUNIT_SCN_LOG_PATH=%SASUNIT_PROJECTROOT%\sasunit_prj\%SASUNIT_LANGUAGE%\scn_logs SET SASUNIT_REPORT_PATH=%SASUNIT_PROJECTROOT%\sasunit_prj\%SASUNIT_LANGUAGE%\doc SET SASUNIT_RUNALL=%SASUNIT_PROJECTROOT%\sasunit_prj\run_all.sas

but initsasunit.sas and runsasunitsetup.sas want the bin directory only in g_sProjectRootFolder, i_root (SASUNIT_PROJECTROOT). It is possible to change initsasunit.sas and runsasunitsetup.sas to have all the sasunit project files to have in one directory?

in this constallation some directories are not created in initsasunit.sas:

%SASUNIT_PROJECTROOT%\sasunit_prj\bin %SASUNIT_TESTDB_PATH% %SASUNIT_LOG_PATH% %SASUNIT_SCN_LOG_PATH% %SASUNIT_REPORT_PATH% %SASUNIT_PROJECTROOT%\sasunit_prj\dat %SASUNIT_PROJECTROOT%\sasunit_prj\doc\spec %SASUNIT_PROJECTROOT%\sasunit_prj\en\doc\tempDoc\crossreference

Respective ticket on SourceForge

Version

2.1 (Default)

Relevant log output

No response

### Tasks
- [x] Rebuild environment
- [x] Check if all folders are generated by runsasunit or are created afterwards.
- [x] Check if SASUnit completes without error
- [x] Document work around
- [x] Create feature request
KLandwich commented 8 months ago

Workaround is possible and will be explained in the next comment. But functionality should be implemented in new feature request.

KLandwich commented 8 months ago

Feature request is #29

KLandwich commented 8 months ago

This is a reasonable approach. As we created the setup script we didn't have that in mind.

SASUnit currently is capable to do so, but not the setup routine. To minimze manual editing of script files you can do the following:

  1. Temoprarily created copy run_all.sas into ....\sasunit_prj\saspgm
  2. Configure setup script to have ...\sasunit_prj as SASUNIT_PROJECTFOLDER
  3. Start setup script
  4. Remove run_all and saspgm folder
  5. Update your run_all.sas to use absolute path to autocall members
  6. Update your run_all.sas to use absolute path to test scenarios in run_sasunit
  7. Update your bin\sasunit<...>.cfg to use correct path to run_all.sas in -sysin

Here are examples of the changes you need to do: sasunit setup script file sasunit.setup.9.4.cmd:

REM --------------------------------------------------------------------------------
REM --- EnvVars for SAS Unit Configuration -----------------------------------------
SET SASUNIT_ROOT=C:\TEMP\_SASUnitTest\v2.1
SET SASUNIT_PROJECTROOT=C:\TEMP\_SASUnitTest\v2.1\example\sasunit_files
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

Update run_all.sas:

%initSASUnit(
   i_root                     = %sysget(SASUNIT_PROJECT_ROOT)
  ,io_target                  = %sysget(SASUNIT_TEST_DB_FOLDER)
  ,i_overwrite                = %sysget(SASUNIT_OVERWRITE)
  ,i_project                  = SASUnit Examples                                  
  ,i_sasunit                  = %sysget(SASUNIT_ROOT)/saspgm/sasunit
  ,i_sasautos                 = C:/TEMP/_SASUnitTest/v2.1/example/saspgm
  ,i_testdata                 = %sysget(SASUNIT_PROJECT_ROOT)/dat
  ,i_refdata                  = %sysget(SASUNIT_PROJECT_ROOT)/dat                 
  ,i_doc                      = doc/spec
  ,i_sascfg                   = %sysget(SASUNIT_SAS_CFG)
  ,i_testcoverage             = %sysget(SASUNIT_COVERAGEASSESSMENT)
/* Run specified test scenarios. There can be more than one call to runSASUnit */
%runSASUnit(i_source = C:/TEMP/_SASUnitTest/v2.1/example/saspgm/%str(*)_test.sas);

Update bin/sasunit.9.4.<os>.<language>.cfg:


-CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
-sysin  C:\TEMP\_SASUnitTest\v2.1\example\saspgm\run_all.sas
-log    C:\TEMP\_SASUnitTest\v2.1\example\sasunit_files\en\logs
-print  C:\TEMP\_SASUnitTest\v2.1\example\sasunit_files\en\logs

This is the way to go with the least manual effort.

We will incoporate this setup into our setup scripts.