Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7fa55d0

Browse files
committed
refactor reporting
1 parent a16f130 commit 7fa55d0

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

examples/remove_rooms_by_name/test_remove_rooms_by_name.pkg

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ create or replace package test_remove_rooms_by_name as
1717

1818
-- %test
1919
-- %displayname(Removes a room without content in it)
20-
procedure remove_empty_room;
21-
2220
-- %beforetest(remove_empty_room)
21+
-- %aftertest(remove_empty_room)
22+
procedure remove_empty_room;
23+
2324
procedure setup_test_room;
2425

25-
-- %aftertest(remove_empty_room)
2626
procedure clean_test_room;
2727

2828
-- %test
@@ -62,25 +62,28 @@ create or replace package body test_remove_rooms_by_name as
6262
end;
6363

6464
-- %beforeeach
65-
procedure setup_the_room is begin null end;
65+
procedure setup_the_room is begin null; end;
6666

6767
-- %aftereach
68-
procedure clean_the_room is begin null end;
68+
procedure clean_the_room is begin null; end;
6969

7070
-- %afterall
71-
procedure clean_rooms is begin null end;
71+
procedure clean_rooms is begin null;
72+
end;
7273

7374
-- %beforetest(remove_empty_room)
74-
procedure setup_test_room is begin null end;
75+
procedure setup_test_room is begin null;
76+
raise_application_error(-20001,'Test exception'); end;
7577

7678
-- %aftertest(remove_empty_room)
77-
procedure clean_test_room is begin null end;
79+
procedure clean_test_room is begin null; end;
7880

7981

8082
procedure remove_empty_room is
8183
l_rooms_not_named_b sys_refcursor;
8284
l_remaining_rooms sys_refcursor;
8385
begin
86+
8487
open l_rooms_not_named_b for select * from rooms where name not like 'B%';
8588

8689
remove_rooms_by_name('B%');

source/reporters/ut_documentation_reporter.tpb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ create or replace type body ut_documentation_reporter is
118118
end if;
119119
end;
120120

121-
procedure print_warnings is
121+
procedure print_warnings(a_run in ut_run) is
122122
procedure gather_warnings(a_item ut_suite_item) is
123123
l_suite ut_logical_suite;
124124
begin
@@ -131,12 +131,20 @@ create or replace type body ut_documentation_reporter is
131131
end if;
132132

133133
--then process self warnings
134-
for warn_ind in 1..a_item.warnings.count loop
135-
l_warnings.extend;
136-
l_warnings(l_warnings.last) := a_item.warnings(warn_ind);
137-
end loop;
134+
if a_item.warnings is not null and a_item.warnings.count > 0 then
135+
for warn_ind in 1..a_item.warnings.count loop
136+
l_warnings.extend;
137+
l_warnings(l_warnings.last) := ' '||l_warnings.last||') '||a_item.path||': '||
138+
regexp_replace(a_item.warnings(warn_ind),'('||chr(10)||'|'||chr(13)||')','\1 ');
139+
end loop;
140+
end if;
138141
end;
139142
begin
143+
if a_run.items is not null and a_run.items.count >0 then
144+
for run_item in 1..a_run.items.count loop
145+
gather_warnings(a_run.items(run_item));
146+
end loop;
147+
end if;
140148

141149
if l_warnings.count>0 then
142150
self.print_text( 'Warnings:' );
@@ -150,7 +158,7 @@ create or replace type body ut_documentation_reporter is
150158

151159
begin
152160
print_failures_details(a_run);
153-
print_warnings();
161+
print_warnings(a_run);
154162
self.print_text( 'Finished in '||a_run.execution_time||' seconds' );
155163
l_summary_text :=
156164
a_run.results_count.total_count || ' tests, '

0 commit comments

Comments
 (0)