Published on :
Unit Test CREATION_INTERNE

Tests for use of autoexec file

This code is also available in: Deutsch Español Français
This program uses the SASUnit framework to initialize a test scenario. The objective is to validate that a specific autoexec file has been loaded during execution. This is verified by the presence of an expected macro variable (&HUGO) and a specific message in the log. It also executes PROC OPTIONS for indicative purposes or environment verification.
Data Analysis

Type : CREATION_INTERNE


The script does not consume data tables. It relies on the session state (macro variables) and execution logs generated by the test framework.

1 Code Block
SASUNIT MACROS
Explanation :
Initialization of the SASUnit test scenario and definition of the first test case targeting '_dummy_macro.sas' to verify autoexec behavior.
Copied!
1%initScenario(i_desc =Tests for use of autoexec file);
2 
3/* test case 1 ------------------------------------*/
4%initTestcase(i_object=_dummy_macro.sas, i_desc=special autoexec should be used);
2 Code Block
PROC OPTIONS
Explanation :
Execution of the OPTIONS procedure to list current SAS system options in the log, useful for debugging the execution context.
Copied!
1PROC OPTIONS;
2RUN;
3 Code Block
SASUNIT ASSERTIONS
Explanation :
Closing the test call and executing assertions: verification of the macro variable &HUGO's value (which must be defined by autoexec), verification of the autoexec file name's presence in the log, and validation of the absence of errors or warnings.
Copied!
1%endTestcall()
2 
3%assertEquals (i_expected=Test for i_autoexec, i_actual=&HUGO, i_desc=must be equal);
4%assertLogMsg (i_logMsg =autoexec_for_autoexec_test.sas);
5 
6%assertLog (i_errors=0, i_warnings=0)
7 
8%endTestcase()
9 
10%endScenario();
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright 2010-2023 HMS Analytical Software GmbH