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!
%initScenario (i_desc=Test of _issueassertinfomessage.sas);
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!
%macro testcase(i_object=_issueassertinfomessage.sas, i_desc=%str(Correct call of examinee));
/*****************
documentation
******************
setup [...]
call [...]
assert [...]
*****************/
/* start testcase */
%initTestcase(i_object=&i_object., i_desc=&i_desc.);
/* call */
%_issueassertinfomessage(Dies ist meine Info-Meldung!);
%endTestcall()
/* assert */
%assertLog (i_errors=0, i_warnings=0);
%assertLogMsg (i_logMsg=^NOTE: Dies ist meine Info-Meldung!);
/* end testcase */
%endTestcase()
%mend testcase;
1
%macro testcase(i_object=_issueassertinfomessage.sas, i_desc=%str(Correct call of examinee));
%_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!
%testcase;
%endScenario();
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/.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.