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

Skip to content

Commit dc6ab50

Browse files
authored
Merge branch 'develop' into issue-364
2 parents 6a2eefb + ea2573e commit dc6ab50

4 files changed

Lines changed: 116 additions & 3 deletions

File tree

source/reporters/ut_documentation_reporter.tpb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ create or replace type body ut_documentation_reporter is
5050
l_message varchar2(4000);
5151

5252
begin
53-
l_message := coalesce(a_test.description, a_test.name);
53+
l_message := coalesce(a_test.description, a_test.name)||' ['||round(a_test.execution_time,3)||' sec]';
5454
--if test failed, then add it to the failures list, print failure with number
5555
if a_test.result = ut_utils.tr_disabled then
5656
self.print_yellow_text(l_message || ' (IGNORED)');
@@ -85,6 +85,10 @@ create or replace type body ut_documentation_reporter is
8585

8686
overriding member procedure after_calling_run(self in out nocopy ut_documentation_reporter, a_run in ut_run) as
8787
l_summary_text varchar2(4000);
88+
l_warning_index pls_integer := 0;
89+
-- make all warning indexes uniformly indented
90+
c_warnings_lpad constant integer := length(to_char(a_run.results_count.warnings_count));
91+
8892
procedure print_failure_for_expectation(a_expectation ut_expectation_result) is
8993
l_lines ut_varchar2_list;
9094
begin
@@ -151,7 +155,8 @@ create or replace type body ut_documentation_reporter is
151155

152156
if a_item.warnings is not null and a_item.warnings.count > 0 then
153157
for i in 1 .. a_item.warnings.count loop
154-
self.print_text(' ' || i || ') ' || a_item.path);
158+
l_warning_index := l_warning_index + 1;
159+
self.print_text(' ' || lpad(l_warning_index, c_warnings_lpad) || ') ' || a_item.path);
155160
self.lvl := self.lvl + 3;
156161
self.print_red_text(a_item.warnings(i));
157162
self.lvl := self.lvl - 3;
@@ -177,6 +182,7 @@ create or replace type body ut_documentation_reporter is
177182
print_failures_details(a_run);
178183
print_warnings(a_run);
179184
self.print_text('Finished in ' || a_run.execution_time || ' seconds');
185+
180186
l_summary_text :=
181187
a_run.results_count.total_count || ' tests, '
182188
|| a_run.results_count.failure_count || ' failed, ' || a_run.results_count.errored_count || ' errored, '

tests/RunAll.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@ exec ut_coverage.coverage_start_develop();
134134
@@lib/RunTest.sql ut_reporters/ut_xunit_reporter.ProducesExpectedOutputs.sql
135135
@@lib/RunTest.sql ut_reporters/ut_html_reporter.UserOverrideSchemaCoverage.sql
136136
@@lib/RunTest.sql ut_reporters/ut_html_reporter.DefaultSchemaCoverage.sql
137+
@@lib/RunTest.sql ut_reporters/ut_documentation_reporter.reportMultipleWarnings.sql
137138
@@lib/RunTest.sql ut_reporters/ut_xunit_reporter.ReportOnSuiteWithoutDesc.sql
138139
@@lib/RunTest.sql ut_reporters/ut_xunit_reporter.ReportOnTestWithoutDesc.sql
140+
@@lib/RunTest.sql ut_reporters/ut_documentation_reporter.reportTestTiming.sql
139141

140142
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileList.sql
141143
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileListWithSutePaths.sql
@@ -229,7 +231,6 @@ exec ut_coverage.coverage_start_develop();
229231
@@lib/RunTest.sql ut_test_suite/ut_test_suite.Rollback_type.ManualOnFailure.sql
230232

231233
@@ut_utils/ut_utils.clob_to_table.sql
232-
@@ut_utils/ut_utils.clob_to_table_multibyte.sql
233234
@@ut_utils/ut_utils.table_to_clob.sql
234235
@@lib/RunTest.sql ut_utils/ut_utils.append_to_clob.worksWithMultiByteChars.sql
235236
@@lib/RunTest.sql ut_utils/ut_utils.test_result_to_char.RunsWithInvalidValues.sql
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
set termout off
2+
create or replace package tst_documrep_mult_warn as
3+
--%suite
4+
5+
--%test
6+
procedure test1;
7+
end;
8+
/
9+
10+
create or replace package body tst_documrep_mult_warn as
11+
procedure test1 is begin commit; end;
12+
end;
13+
/
14+
create or replace package tst_documrep_mult_warn2 as
15+
--%suite
16+
17+
--%test
18+
procedure test1;
19+
end;
20+
/
21+
22+
create or replace package body tst_documrep_mult_warn2 as
23+
procedure test1 is begin commit; end;
24+
end;
25+
/
26+
27+
set termout on
28+
29+
declare
30+
l_test_report ut_varchar2_list;
31+
l_output_data ut_varchar2_list;
32+
l_output varchar2(32767);
33+
l_expected varchar2(32767);
34+
begin
35+
l_expected := q'[%Warnings:
36+
%1)%tst_documrep_mult_warn%
37+
%2)%tst_documrep_mult_warn%]';
38+
39+
--act
40+
select *
41+
bulk collect into l_output_data
42+
from table(ut.run(ut_varchar2_list('tst_documrep_mult_warn','tst_documrep_mult_warn2'),ut_documentation_reporter()));
43+
44+
l_output := ut_utils.table_to_clob(l_output_data);
45+
46+
--assert
47+
if l_output like l_expected then
48+
:test_result := ut_utils.tr_success;
49+
else
50+
dbms_output.put_line('Actual:"'||l_output||'"');
51+
end if;
52+
end;
53+
/
54+
55+
drop package tst_documrep_mult_warn;
56+
drop package tst_documrep_mult_warn2;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
set termout off
2+
create or replace package tst_doc_reporter_timing as
3+
--%suite
4+
5+
--%test
6+
procedure test1;
7+
8+
--%test
9+
procedure test2;
10+
end;
11+
/
12+
13+
create or replace package body tst_doc_reporter_timing as
14+
procedure test1 is begin ut.expect(1).to_equal(1); end;
15+
procedure test2 is begin ut.expect(1).to_equal(2); end;
16+
end;
17+
/
18+
19+
set termout on
20+
21+
declare
22+
l_test_report ut_varchar2_list;
23+
l_output_data ut_varchar2_list;
24+
l_output varchar2(32767);
25+
l_expected varchar2(32767);
26+
begin
27+
l_expected := q'[tst_doc_reporter_timing
28+
%test1 [%sec]
29+
%test2 [%sec] (FAILED - 1)
30+
%Failures:%
31+
Finished in % seconds
32+
2 tests, 1 failed, 0 errored, 0 disabled, 0 warning(s)%]';
33+
34+
--act
35+
select *
36+
bulk collect into l_output_data
37+
from table(ut.run('tst_doc_reporter_timing',ut_documentation_reporter()));
38+
39+
l_output := ut_utils.table_to_clob(l_output_data);
40+
41+
--assert
42+
if l_output like l_expected then
43+
:test_result := ut_utils.tr_success;
44+
else
45+
dbms_output.put_line('Actual:"'||l_output||'"');
46+
end if;
47+
end;
48+
/
49+
50+
drop package tst_doc_reporter_timing;

0 commit comments

Comments
 (0)