29 %MACRO reportSASUnit (i_language = EN
37 %LET l_macname=&sysmacroname;
40 %IF
"&o_html" NE
"1" %THEN %LET o_html=0;
42 %IF
"&o_force" NE
"1" %THEN %LET o_force=0;
44 %IF
"&o_junit" NE
"1" %THEN %LET o_junit=0;
46 %IF (
"&o_html" NE
"1" AND
"&o_junit" NE
"1") %THEN %DO;
50 %_nls (i_language=&i_language)
54 %IF %length(&o_output) %THEN %LET l_output=&o_output;
55 %ELSE %LET l_output =&g_target/rep;
56 %LET l_output=%_abspath(&g_root,&l_output);
58 %IF %_handleError(&l_macname.
60 ,NOT %_existDir(&l_output)
61 ,Error in parameter o_output: target folder does not exist
62 ,i_verbose=&g_verbose.
67 %IF %_handleError(&l_macname.
69 ,NOT %sysfunc(exist(target.tsu)) OR NOT %symexist(g_project)
70 ,%nrstr(Test database cannot be accessed, call initSASUnit before reportSASUnit)
71 ,i_verbose=&g_verbose.
89 %_tempFilename(d_cas01)
90 %_tempFilename(d_auton)
93 %_tempFilename(d_emptyscn)
101 l_sEmptyScnDummyCasDesc
103 %LET l_sEmptyScnDummyCasDesc = %STR(no valid test
case found - must be red!);
106 CREATE TABLE &d_emptyscn. AS
110 WHERE t1.scn_id NOT IN
121 CREATE TABLE &d_cas. AS
144 ,
"&l_sEmptyScnDummyCasDesc."
155 CREATE TABLE &d_tst. AS
189 PROC SORT DATA=target.scn OUT=&d_scn;
197 PROC SORT DATA=&d_cas OUT=&d_cas01;
203 cas_last = last.cas_scnid;
204 cas_pgmucase = upcase(cas_pgm);
207 PROC SORT DATA=&d_cas (KEEP=cas_auton RENAME=(cas_auton=auton_id))
208 OUT=&d_auton NODUPKEY;
212 SET &d_auton END=eof;
217 SET &d_cas (KEEP=cas_auton cas_pgm RENAME=(cas_auton=pgm_auton cas_pgm=pgm_ucase));
218 pgm_ucase = upcase(pgm_ucase);
220 PROC SORT DATA=&d_pgm NODUPKEY;
221 BY pgm_auton pgm_ucase;
226 IF first.pgm_auton THEN pgm_id=0;
228 pgm_last = last.pgm_auton;
231 create table work.pgm_res as
232 select upcase (cas_pgm) as pgm_ucase
233 ,max (cas_res) as pgm_res
236 create table &d_pgm. as
239 from &d_pgm._ a left join work.pgm_res b
240 on a.pgm_ucase = b.pgm_ucase;
244 SET &d_cas (KEEP=cas_auton cas_pgm cas_scnid cas_id RENAME=(cas_auton=pcs_auton cas_pgm=pcs_ucase cas_scnid=pcs_scnid cas_id=pcs_casid));
245 pcs_ucase = upcase(pcs_ucase);
247 PROC SORT DATA=&d_pcs OUT=&d_pcs NODUPKEY;
248 BY pcs_auton pcs_ucase pcs_scnid pcs_casid;
252 BY pcs_auton pcs_ucase;
253 pcs_last = last.pcs_ucase;
260 CREATE TABLE &d_rep (COMPRESS=YES) AS
320 scn_id = cas_scnid AND
321 cas_scnid = tst_scnid AND
322 cas_id = tst_casid AND
323 cas_auton = auton_id AND
324 cas_auton = pgm_auton AND
325 cas_pgmucase = pgm_ucase AND
326 cas_auton = pcs_auton AND
327 cas_pgmucase = pcs_ucase AND
328 cas_scnid = pcs_scnid AND
330 order by scn_id, cas_id, tst_id;
331 CREATE UNIQUE INDEX idx1 ON &d_rep. (scn_id, cas_id, tst_id);
332 CREATE UNIQUE INDEX idx2 ON &d_rep. (cas_auton, pgm_id, scn_id, cas_id, tst_id);
335 %IF %_handleError(&l_macname.
338 ,%nrstr(Fehler beim Zugriff auf die Testdatenbank)
339 ,i_verbose=&g_verbose.
346 l_bOnlyInexistingScnFound
349 SELECT coalesce(max(scn_start),0) FORMAT=12.0 INTO :l_lastrun FROM target.scn;
353 %LET l_bOnlyInexistingScnFound = 1;
355 SET target.scn ( KEEP = scn_start );
356 IF scn_start > 0 THEN DO;
358 Call Symputx ('l_bOnlyInexistingScnFound', '0');
364 FILENAME repgen temp;
366 *** Create formats used in reports ***;
367 proc format lib=work;
368 value PictName 0 = "&g_sasunitroot./resources/html/ok.png"
369 1 = "&g_sasunitroot./resources/html/manual.png"
370 2 = "&g_sasunitroot./resources/html/error.png"
372 value PictNameHTML 0 = "ok.png"
376 value PictDesc 0 = "OK"
377 1 = "&g_nls_reportDetail_026"
378 2 = "&g_nls_reportDetail_025"
379 OTHER = "&g_nls_reportDetail_027";
382 *** set options for ODS ****;
385 *** create style ****;
387 %let l_rc = %_delfile(&g_sasunitroot./resources/style/template.sas7bitm);
389 libname _style "&g_sasunitroot./resources/style";
392 ods path (PREPEND) _style.template(UPDATE);
394 %_reportCreateTagset;
397 ods path (PREPEND) _style.template(READ);
398 ods path (PREPEND) WORK.template(UPDATE);
400 %IF (&o_html.=1) %THEN %DO;
409 IF tsu_lastrep=0 OR &o_force THEN DO;
412 " &g_sasunitroot./resources" '/html/%str(*)' /
416 PUT '%_reportFrameHTML(' /
417 " i_repdata = &d_rep" /
418 " ,o_html = &l_output/index.html" /
422 IF tsu_lastinit > tsu_lastrep OR &o_force THEN DO;
424 PUT '%_reportLogHTML(' /
425 " i_log = &g_log/000.log" /
426 " ,i_title = &g_nls_reportSASUnit_001" /
427 " ,o_html = &l_output/000_log.html" /
430 PUT '%_reportHomeHTML(' /
431 " i_repdata = &d_rep" /
432 " ,o_html = &o_html." /
433 " ,o_path = &l_output." /
434 " ,o_file = overview" /
438 IF &l_lastrun > tsu_lastrep OR &l_bOnlyInexistingScnFound. OR &o_force. THEN DO;
440 PUT '%_reportTreeHTML(' /
441 " i_repdata = &d_rep" /
442 " ,o_html = &l_output/tree.html" /
445 PUT '%_reportScnHTML(' /
446 " i_repdata = &d_rep." /
447 " ,o_html = &o_html." /
448 " ,o_path = &l_output." /
449 " ,o_file = scn_overview" /
452 PUT '%_reportCasHTML(' /
453 " i_repdata = &d_rep" /
454 " ,o_html = &o_html." /
455 " ,o_path = &l_output." /
456 " ,o_file = cas_overview" /
459 PUT '%_reportAutonHTML(' /
460 " i_repdata = &d_rep" /
461 " ,o_html = &o_html." /
462 " ,o_path = &l_output." /
463 " ,o_file = auton_overview" /
474 IF first.scn_id AND scn_id NE . THEN DO;
476 IF scn_start > tsu_lastrep OR &o_force THEN DO;
478 PUT '%_reportLogHTML(' /
479 " i_log = &g_log/" scn_id z3. ".log" /
480 " ,i_title = &g_nls_reportSASUnit_002 " scn_id z3. " (" cas_pgm +(-1) ")" /
481 " ,o_html = &l_output/" scn_id z3. "_log.html" /
484 PUT '%_reportDetailHTML(' /
485 " i_repdata = &d_rep" /
486 " ,i_scnid = " scn_id z3. /
487 " ,o_html = &o_html." /
488 " ,o_path = &l_output." /
489 " ,o_file = cas_" scn_id z3. /
495 IF cas_start > tsu_lastrep OR &o_force THEN DO;
498 IF first.cas_id AND scn_id NE . AND cas_id NE . THEN DO;
500 PUT '%_reportLogHTML(' /
501 " i_log = &g_log/" scn_id z3. "_" cas_id z3. ".log" /
502 " ,i_title = &g_nls_reportSASUnit_003 " cas_id z3. " &g_nls_reportSASUnit_004 " scn_id z3. " (" cas_pgm +(-1) ")" /
503 " ,o_html = &l_output/" scn_id z3. "_" cas_id z3. "_log.html" /
514 %INCLUDE repgen / source2;
517 %IF (&o_junit.=1) %THEN %DO;
518 %_reportJUnitXML(o_file=&l_output./junit.xml)
524 SET tsu_lastrep = %sysfunc(datetime())
531 %PUT ======================== Error! reportSASUnit aborted! ==========================================;
535 PROC DATASETS NOWARN NOLIST LIB=work;
536 DELETE %scan(&d_rep,2,.) %scan(&d_scn,2,.) %scan(&d_cas01.,2,.) %scan(&d_cas.,2,.) %scan(&d_auton,2,.)
537 %scan(&d_pgm,2,.) %scan(&d_pcs,2,.) %scan(&d_emptyscn.,2,.);