24 %macro _getScenarioTestId (i_scnid=
29 %LOCAL l_casid_gti l_tstid_gti;
31 %*** Set
return variable to missing, the designed value
for an error ***;
33 %IF %nrbquote (&i_scnid.) eq %THEN %DO;
34 %PUT &g_error.(SASUNIT): Please specify a value for i_scnid.;
38 %IF %nrbquote (&r_casid.) eq %THEN %DO;
39 %PUT &g_error.(SASUNIT): Please specify a value for r_casid.;
43 %IF %nrbquote (&r_tstid.) eq %THEN %DO;
44 %PUT &g_error.(SASUNIT): Please specify a value for r_tstid.;
48 %IF not %symexist(&r_casid.) %THEN %DO;
49 %PUT &g_error.(SASUNIT): Macrovariable for return of test case
id was not declared by a %nrstr(%%)local-statement.;
52 %let &r_casid.=_ERROR_;
54 %IF not %symexist(&r_tstid.) %THEN %DO;
55 %PUT &g_error.(SASUNIT): Macrovariable for return of test assert
id was not declared by a %nrstr(%%)local-statement.;
58 %let &r_tstid.=_ERROR_;
60 %IF not %sysfunc (exist (target.cas)) %THEN %DO;
61 %PUT &g_error.(SASUNIT): Table target.cas does not exist. Start this macro only within SASUnit.;
65 %IF not %sysfunc (exist (target.tst)) %THEN %DO;
66 %PUT &g_error.(SASUNIT): Table target.tst does not exist. Start this macro only within SASUnit.;
71 *** determine number of the current test case ****;
72 SELECT max(cas_id) INTO :l_casid_gti FROM target.cas WHERE cas_scnid = &i_scnid.;
75 %IF &l_casid_gti = . OR &l_casid_gti = %THEN %DO;
76 %PUT &g_error.(SASUNIT): Scenario was not found in the test database.;
77 %PUT &g_error.(SASUNIT): Assert may not be called prior to initTestcase.;
82 *** determine number of the current test case ****;
83 SELECT max(tst_id) INTO :l_tstid_gti FROM target.tst WHERE tst_scnid = &i_scnid. AND tst_casid=&l_casid_gti.;
85 %IF &l_tstid_gti.=. %THEN %LET l_tstid_gti=1;
86 %ELSE %LET l_tstid_gti=%eval (&l_tstid_gti.+1);
88 %let &r_casid.=&l_casid_gti.;
89 %let &r_tstid.=&l_tstid_gti.;
90 %mend _getScenarioTestId;