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;
232 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));
233 pcs_ucase = upcase(pcs_ucase);
234 PROC SORT DATA=&d_pcs OUT=&d_pcs NODUPKEY;
235 BY pcs_auton pcs_ucase pcs_scnid pcs_casid;
239 BY pcs_auton pcs_ucase;
240 pcs_last = last.pcs_ucase;
246 CREATE TABLE &d_rep (COMPRESS=YES) AS
305 scn_id = cas_scnid AND
306 cas_scnid = tst_scnid AND
307 cas_id = tst_casid AND
308 cas_auton = auton_id AND
309 cas_auton = pgm_auton AND
310 cas_pgmucase = pgm_ucase AND
311 cas_auton = pcs_auton AND
312 cas_pgmucase = pcs_ucase AND
313 cas_scnid = pcs_scnid AND
315 order by scn_id, cas_id, tst_id;
316 CREATE UNIQUE INDEX idx1 ON &d_rep. (scn_id, cas_id, tst_id);
317 CREATE UNIQUE INDEX idx2 ON &d_rep. (cas_auton, pgm_id, scn_id, cas_id, tst_id);
320 %IF %_handleError(&l_macname.
323 ,%nrstr(Fehler beim Zugriff auf die Testdatenbank)
324 ,i_verbose=&g_verbose.
331 l_bOnlyInexistingScnFound
334 SELECT coalesce(max(scn_start),0) FORMAT=12.0 INTO :l_lastrun FROM target.scn;
338 %LET l_bOnlyInexistingScnFound = 1;
340 SET target.scn ( KEEP = scn_start );
341 IF scn_start > 0 THEN DO;
343 Call Symputx ('l_bOnlyInexistingScnFound', '0');
349 FILENAME repgen temp;
351 *** Create formats used in reports ***;
352 proc format lib=work;
353 value PictName 0 = "&g_sasunitroot./resources/html/ok.png"
354 1 = "&g_sasunitroot./resources/html/manual.png"
355 2 = "&g_sasunitroot./resources/html/error.png"
357 value PictNameHTML 0 = "ok.png"
361 value PictDesc 0 = "OK"
362 1 = "&g_nls_reportDetail_026"
363 2 = "&g_nls_reportDetail_025"
364 OTHER = "&g_nls_reportDetail_027";
367 *** set options for ODS ****;
370 *** create style ****;
372 %let l_rc = %_delfile(&g_sasunitroot./resources/style/template.sas7bitm);
374 libname _style "&g_sasunitroot./resources/style";
377 ods path (PREPEND) _style.template(UPDATE);
379 %_reportCreateTagset;
382 ods path (PREPEND) _style.template(READ);
383 ods path (PREPEND) WORK.template(UPDATE);
385 %IF (&o_html.=1) %THEN %DO;
394 IF tsu_lastrep=0 OR &o_force THEN DO;
397 " &g_sasunitroot./resources" '/html/%str(*.*)' /
401 PUT '%_reportFrameHTML(' /
402 " i_repdata = &d_rep" /
403 " ,o_html = &l_output/index.html" /
407 IF tsu_lastinit > tsu_lastrep OR &o_force THEN DO;
409 PUT '%_reportLogHTML(' /
410 " i_log = &g_log/000.log" /
411 " ,i_title = &g_nls_reportSASUnit_001" /
412 " ,o_html = &l_output/000_log.html" /
415 PUT '%_reportHomeHTML(' /
416 " i_repdata = &d_rep" /
417 " ,o_html = &o_html." /
418 " ,o_path = &l_output." /
419 " ,o_file = overview" /
423 IF &l_lastrun > tsu_lastrep OR &l_bOnlyInexistingScnFound. OR &o_force. THEN DO;
425 PUT '%_reportTreeHTML(' /
426 " i_repdata = &d_rep" /
427 " ,o_html = &l_output/tree.html" /
430 PUT '%_reportScnHTML(' /
431 " i_repdata = &d_rep." /
432 " ,o_html = &o_html." /
433 " ,o_path = &l_output." /
434 " ,o_file = scn_overview" /
437 PUT '%_reportCasHTML(' /
438 " i_repdata = &d_rep" /
439 " ,o_html = &o_html." /
440 " ,o_path = &l_output." /
441 " ,o_file = cas_overview" /
444 PUT '%_reportAutonHTML(' /
445 " i_repdata = &d_rep" /
446 " ,o_html = &o_html." /
447 " ,o_path = &l_output." /
448 " ,o_file = auton_overview" /
459 IF first.scn_id AND scn_id NE . THEN DO;
461 IF scn_start > tsu_lastrep OR &o_force THEN DO;
463 PUT '%_reportLogHTML(' /
464 " i_log = &g_log/" scn_id z3. ".log" /
465 " ,i_title = &g_nls_reportSASUnit_002 " scn_id z3. " (" cas_pgm +(-1) ")" /
466 " ,o_html = &l_output/" scn_id z3. "_log.html" /
469 PUT '%_reportDetailHTML(' /
470 " i_repdata = &d_rep" /
471 " ,i_scnid = " scn_id z3. /
472 " ,o_html = &o_html." /
473 " ,o_path = &l_output." /
474 " ,o_file = cas_" scn_id z3. /
480 IF cas_start > tsu_lastrep OR &o_force THEN DO;
483 IF first.cas_id AND scn_id NE . AND cas_id NE . THEN DO;
485 PUT '%_reportLogHTML(' /
486 " i_log = &g_log/" scn_id z3. "_" cas_id z3. ".log" /
487 " ,i_title = &g_nls_reportSASUnit_003 " cas_id z3. " &g_nls_reportSASUnit_004 " scn_id z3. " (" cas_pgm +(-1) ")" /
488 " ,o_html = &l_output/" scn_id z3. "_" cas_id z3. "_log.html" /
499 %INCLUDE repgen / source2;
502 %IF (&o_junit.=1) %THEN %DO;
503 %_reportJUnitXML(o_file=&l_output./junit.xml)
509 SET tsu_lastrep = %sysfunc(datetime())
516 %PUT ======================== Error! reportSASUnit aborted! ==========================================;
520 PROC DATASETS NOWARN NOLIST LIB=work;
521 DELETE %scan(&d_rep,2,.) %scan(&d_scn,2,.) %scan(&d_cas01.,2,.) %scan(&d_cas.,2,.) %scan(&d_auton,2,.)
522 %scan(&d_pgm,2,.) %scan(&d_pcs,2,.) %scan(&d_emptyscn.,2,.);