SASUnit Examples  Version 1.2
_sasunit_reportautonhtml.sas
Go to the documentation of this file.
1 
20 /* change history
21  02.01.2013 KL Added new column "Assertions" and corrected the number in column "Test Cases".
22  program library (none) is now supported under different languages.
23  12.08.2008 AM Mehrsprachigkeit
24  29.12.2007 AM Neuererstellung
25 */
26 
27 %MACRO _sasunit_reportAutonHTML (
28  i_repdata =
29  ,o_html =
30 );
31 
32 /*-- determine number of scenarios
33  and number of test cases per unit under test ----------------------------*/
34 %LOCAL d_rep1 d_rep2;
35 %_sasunit_tempFileName(d_rep1)
36 %_sasunit_tempFileName(d_rep2)
37 
38 
39 PROC MEANS NOPRINT NWAY DATA=&i_repdata(KEEP=cas_auton pgm_id scn_id cas_res);
40  BY cas_auton pgm_id scn_id;
41  CLASS cas_res;
42  OUTPUT OUT=&d_rep1 (drop=_type_);
43 RUN;
44 
45 PROC TRANSPOSE DATA=&d_rep1 OUT=&d_rep1 (DROP=_name_) PREFIX=res;
46  BY cas_auton pgm_id scn_id;
47  VAR _freq_;
48  ID cas_res;
49 RUN;
50 
51 PROC MEANS NOPRINT NWAY DATA=&d_rep1(KEEP=cas_auton pgm_id);
52  BY cas_auton pgm_id;
53  OUTPUT OUT=&d_rep2 (DROP=_type_ RENAME=(_freq_=scn_count));
54 RUN;
55 
56 DATA &d_rep1 (COMPRESS=YES);
57  MERGE &i_repdata (KEEP=cas_auton pgm_id scn_id cas_pgm tsu_sasautos tsu_sasautos1-tsu_sasautos9) &d_rep1;
58  BY cas_auton pgm_id scn_id;
59  IF res0=. THEN res0=0;
60  IF res1=. THEN res1=0;
61  IF res2=. THEN res2=0;
62 RUN;
63 
64 DATA &d_rep1 (COMPRESS=YES);
65  MERGE &d_rep1 &d_rep2;
66  BY cas_auton pgm_id;
67 RUN;
68 
69 PROC MEANS NOPRINT NWAY missing DATA=&i_repdata(KEEP=cas_auton pgm_id scn_id cas_id);
70  class cas_auton pgm_id scn_id cas_id;
71  OUTPUT OUT=&d_rep2;
72 RUN;
73 
74 PROC MEANS NOPRINT NWAY missing DATA=&d_rep2(KEEP=cas_auton pgm_id scn_id cas_id);
75  class cas_auton pgm_id scn_id;
76  OUTPUT OUT=&d_rep2 (drop=_type_ cas_id rename=(_freq_=scn_cas)) N=;
77 RUN;
78 
79 DATA &d_rep1 (COMPRESS=YES);
80  MERGE &d_rep1 &d_rep2;
81  BY cas_auton pgm_id scn_id;
82 RUN;
83 
84 DATA _null_;
85  SET &d_rep1 END=eof;
86  BY cas_auton pgm_id scn_id;
87 
88  FILE "&o_html";
89 
90  IF _n_=1 THEN DO;
91  %_sasunit_reportPageTopHTML(
92  i_title = %str(&g_nls_reportAuton_001 | &g_project - SASUnit &g_nls_reportAuton_002)
93  ,i_current = 4
94  )
95  END;
96 
97  LENGTH hlp1 hlp2 hlp3 $256;
98  RETAIN hlp3;
99 
100  IF first.cas_auton THEN DO;
101  IF _n_>1 THEN DO;
102  PUT '<hr size="1">';
103  END;
104  IF cas_auton NE . THEN hlp3 = 'auton' !! put (cas_auton, z3.);
105  ELSE hlp3 = 'auton';
106  PUT '<table id="' hlp3 +(-1) '"><tr>';
107  PUT " <td>&g_nls_reportAuton_003</td>";
108  IF cas_auton>=0 THEN DO;
109  ARRAY sa(0:9) tsu_sasautos tsu_sasautos1-tsu_sasautos9;
110  hlp1 = sa(cas_auton);
111  IF cas_auton=0 THEN hlp2 = symget('g_sasautos');
112  ELSE hlp2 = symget ('g_sasautos' !! compress(put(cas_auton,8.)));
113  PUT ' <td><a class="lightlink" title="' "&g_nls_reportAuton_004 " '&#x0D;' hlp2 +(-1) '" href="file://' hlp2 +(-1) '">' hlp1 +(-1) '</a></td>';
114  END;
115  ELSE DO;
116  PUT " <td>&g_nls_reportAuton_015</td>";
117  END;
118  PUT '</tr></table>';
119 
120  PUT '<table>';
121  PUT '<tr>';
122  PUT ' <td class="tabheader">' "&g_nls_reportAuton_005" '</td>';
123  PUT ' <td class="tabheader">' "&g_nls_reportAuton_006" '</td>';
124  PUT ' <td class="tabheader">' "&g_nls_reportAuton_007" '</td>';
125  PUT ' <td class="tabheader">' "&g_nls_reportAuton_014" '</td>';
126  PUT ' <td class="tabheader">' "&g_nls_reportAuton_008" '</td>';
127  PUT '</tr>';
128  END;
129 
130  IF first.scn_id THEN DO;
131  PUT '<tr>';
132  END;
133 
134  IF first.pgm_id THEN DO;
135  IF cas_auton = . THEN DO;
136  hlp2 = resolve ('%_sasunit_abspath(&g_root,' !! trim(cas_pgm) !! ')');
137  END;
138  ELSE DO;
139  IF cas_auton = 0 THEN hlp1 = '&g_sasautos';
140  ELSE hlp1 = '&g_sasautos' !! compress (put (cas_auton,8.));
141  hlp2 = resolve ('%_sasunit_abspath(' !! trim(hlp1) !! ',' !! trim(cas_pgm) !! ')');
142  END;
143  PUT ' <td id="' hlp3 +(-1) '_' pgm_id z3. '" rowspan="' scn_count +(-1) '" class="datacolumn"><a class="lightlink" title="' "&g_nls_reportAuton_009 " '&#x0D;' hlp2 +(-1) '" href="' hlp2 +(-1) '">' cas_pgm +(-1) '</a></td>';
144  END;
145 
146  IF first.scn_id THEN DO;
147  PUT ' <td class="datacolumn"><a class="lightlink" title="' "&g_nls_reportAuton_010 " scn_id z3. '" href="cas_overview.html#scn' scn_id z3. '">' scn_id z3. '</a></td>';
148  hlp1 = left (put (scn_cas, 8.));
149  PUT ' <td class="datacolumn">' hlp1 +(-1) '</td>';
150  hlp1 = left (put (sum (res0, res1, res2), 8.));
151  PUT ' <td class="datacolumn">' hlp1 +(-1) '</td>';
152  PUT ' <td class="iconcolumn"><img src=' @;
153  IF res1>0 THEN PUT '"error.png" alt="' "&g_nls_reportAuton_011" '"' @;
154  ELSE IF res2>0 THEN PUT '"manual.png" alt="' "&g_nls_reportAuton_012" '"' @;
155  ELSE IF res0>0 THEN PUT '"ok.png" alt="OK"' @;
156  ELSE PUT '"?????" alt="' "&g_nls_reportAuton_013" '"' @;
157  PUT '></img></td>';
158  PUT '</tr>';
159  END;
160 
161  IF last.cas_auton THEN DO;
162  PUT '</table>';
163  END;
164 
165  IF eof THEN DO;
166  %_sasunit_reportFooterHTML()
167  END;
168 
169 RUN;
170 
171 PROC DATASETS NOWARN NOLIST LIB=work;
172  DELETE %scan(&d_rep1,2,.) %scan(&d_rep2,2,.);
173 QUIT;
174 
175 %MEND _sasunit_reportAutonHTML;