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

Skip to content

Commit ea719b2

Browse files
committed
implemented timing reporting for documentation reporter
1 parent 65d0169 commit ea719b2

3 files changed

Lines changed: 52 additions & 1 deletion

File tree

source/reporters/ut_documentation_reporter.tpb

Lines changed: 1 addition & 1 deletion
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)');

tests/RunAll.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ 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.reportTestTiming.sql
137138

138139
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileList.sql
139140
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileListWithSutePaths.sql
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_xunit_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)