Published on :
Test INTERNAL_CREATION

Test of _issueassertinfomessage.sas

This code is also available in: Français Deutsch Español
This script uses the SASUnit framework to test the `_issueassertinfomessage` macro. It initializes a test scenario, defines a test case that calls the macro with a specific message, then verifies that the expected message appears in the SAS© log and that there are no errors or warnings. The objective is to ensure that the macro correctly emits informational messages in the log.
Data Analysis

Type : INTERNAL_CREATION


The script does not manipulate external or internal data via SASHELP tables. It is entirely dedicated to calling and verifying the outputs of a SAS macro, simulating internal test conditions.

1 Code Block
MACRO CALL
Explanation :
Initializes a new SASUnit test scenario, assigning it a description. This is the first step to organize unit tests with SASUnit.
Copied!
1%initScenario (i_desc=Test of _issueassertinfomessage.sas);
2 
2 Code Block
MACRO DEFINITION
Explanation :
Defines a macro named `testcase` that encapsulates the logic of a specific unit test. This macro initializes a test case, calls the `_issueassertinfomessage` macro with an informational message, then uses SASUnit assertions (`%assertLog`, `%assertLogMsg`) to verify that the SAS log contains no errors or warnings and that the expected informational message is present.
Copied!
1%macro testcase(i_object=_issueassertinfomessage.sas, i_desc=%str(Correct call of examinee));
2 /*****************
3 documentation
4 ******************
5 setup [...]
6 call [...]
7 assert [...]
8 *****************/
9 
10 /* start testcase */
11 %initTestcase(i_object=&i_object., i_desc=&i_desc.);
12 
13 /* call */
14 %_issueassertinfomessage(Dies ist meine Info-Meldung!);
15 
16 %endTestcall()
17 
18 /* assert */
19 %assertLog (i_errors=0, i_warnings=0);
20 %assertLogMsg (i_logMsg=^NOTE: Dies ist meine Info-Meldung!);
21 
22 /* end testcase */
23 %endTestcase()
24%mend testcase;
3 Code Block
MACRO CALLS
Explanation :
These lines execute the previously defined `testcase` macro, thereby triggering the unit test. Then, `%endScenario()` closes the SASUnit test scenario, marking the end of test execution for this script.
Copied!
1%testcase;
2 
3%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, http://www.analytical-software.de. This file is part of SASUnit, the Unit testing framework for SAS(R) programs. For copyright information and terms of usage under the GNU Lesser General Public License see included file README.md or https://github.com/HMS-Analytical-Software/SASUnit/wiki/readme/.