Published on :
Unit Test CREATION_INTERNE

Test of SASUnit assertManual macro

This code is also available in: Deutsch Español Français
The script executes two test cases for the %assertManual macro. The first case calls %assertManual without a description, verifying that the default value is recorded. The second case calls %assertManual with a specified description, verifying that this description is correctly recorded. Assertions check the values recorded in the SASUnit-generated test results table 'tst'.
Data Analysis

Type : CREATION_INTERNE


Data is created and managed internally by the SASUnit framework for recording test results (%assertDBValue checks an internal SASUnit 'tst' table).

1 Code Block
Macros SASUnit
Explanation :
This block initializes a new test scenario for 'assertManual.sas'. It then defines the first test case, without an explicit description for %assertManual. The %assertDBValue macros are used to verify that the SASUnit 'tst' results table contains the expected values for the assertion type, the default description ('Manual assert - serves as placeholder'), and the test result.
Copied!
1%initScenario(i_desc =Test of assertManual.sas)
2 
3%let scnid = %substr(00&g_scnid,%LENGTH(&g_scnid));
4 
5%initTestcase(i_object=assertManual.sas, i_desc=%str(call without description))
6%endTestcall()
7%assertManual()
8%markTest()
9options mlogic symbolgen mprint SOURCE notes;
10%assertDBValue(tst,type,assertManual)
11%assertDBValue(tst,desc,Manual assert - serves as placeholder)
12%assertDBValue(tst,exp,)
13%assertDBValue(tst,act,)
14%assertDBValue(tst,res,1)
15%endTestcase(i_assertLog=0)
2 Code Block
Macros SASUnit
Explanation :
This block defines the second test case, this time with a specific description ('the description 1') provided to %assertManual. The %assertDBValue macros verify that the 'tst' table correctly records this custom description, as well as the assertion type and result. The test scenario is then closed by %endScenario.
Copied!
1%initTestcase(i_object=assertManual.sas, i_desc=%str(description specified))
2%endTestcall()
3%assertManual(i_desc=the description 1)
4%markTest()
5%assertDBValue(tst,type,assertManual)
6%assertDBValue(tst,desc,the description 1)
7%assertDBValue(tst,exp,)
8%assertDBValue(tst,act,)
9%assertDBValue(tst,res,1)
10%endTestcase(i_assertLog=0)
11 
12%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/.