SASUnit Examples  Version 1.5.0
endtestcase.sas
Go to the documentation of this file.
1 
26 %MACRO endTestcase(i_assertLog=1);
27 
28  %GLOBAL g_inTestcase;
29  %LOCAL l_casid l_assertLog l_result;
30 
31  PROC SQL NOPRINT;
32  /* determine id of current test case */
33  SELECT max(cas_id) INTO :l_casid FROM target.cas WHERE cas_scnid=&g_scnid;
34  %LET l_casid = &l_casid;
35  %IF &l_casid=. %THEN %DO;
36  %PUT &g_error.(SASUNIT): endTestcase muss nach InitTestcase aufgerufen werden;
37  %RETURN;
38  %END;
39  %IF &i_assertLog %THEN %DO;
40  /* call assertLog if not already coded by programmer */
41  SELECT count(*) INTO :l_assertLog
42  FROM target.tst
43  WHERE tst_scnid = &g_scnid AND tst_casid = &l_casid AND tst_type='assertLog';
44  %IF &l_assertLog=0 %THEN %DO;
45  %assertLog()
46  %END;
47  %END;
48  QUIT;
49 
50  %IF &g_inTestcase EQ 1 %THEN %DO;
51  %endTestcall;
52  %END;
53  %ELSE %IF &g_inTestcase NE 2 %THEN %DO;
54  %PUT &g_error.(SASUNIT): endTestcase muss nach initTestcase aufgerufen werden;
55  %RETURN;
56  %END;
57  %LET g_inTestcase=0;
58 
59  /* determine test results */
60  PROC SQL NOPRINT;
61  SELECT max (tst_res) INTO :l_result FROM target.tst WHERE tst_scnid=&g_scnid AND tst_casid=&l_casid;
62  QUIT;
63 
64  PROC SQL NOPRINT;
65  UPDATE target.cas
66  SET
67  cas_res = &l_result
68  WHERE
69  cas_scnid = &g_scnid AND
70  cas_id = &l_casid;
71  QUIT;
72 
73 %MEND endTestcase;