Skip to content

Commit ad3f77a

Browse files
committed
Added the Test Runs Summary Table
1 parent 03403c6 commit ad3f77a

File tree

4 files changed

+173
-3
lines changed

4 files changed

+173
-3
lines changed

src/core/duane.sql

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
-- Need to test the new insert_test_runs_summary.
3+
-- Need to create the view that uses this data.
4+
5+
with q1 as (
6+
select dbout_owner
7+
,dbout_name
8+
,dbout_type
9+
,max(start_dtm) MAX_START_DTM
10+
from wt_test_runs
11+
group by dbout_owner
12+
,dbout_name
13+
,dbout_type
14+
)
15+
select obj.owner
16+
,obj.object_name
17+
,obj.object_type
18+
,q1.max_start_dtm
19+
from all_objects obj
20+
left join q1
21+
on q1.dbout_owner = obj.owner
22+
and q1.dbout_name = obj.object_name
23+
and q1.dbout_type = obj.object_type
24+
left join wt_test_runs run
25+
on run.dbout_owner = q1.dbout_owner
26+
and run.dbout_name = q1.dbout_name
27+
and run.dbout_type = q1.dbout_type
28+
and run.start_dtm = q1.max_start_dtm
29+
where obj.object_type in ('FUNCTION','LIBRARY','OPERATOR',
30+
'PACKAGE','PACKAGE BODY','PROCEDURE','TABLE',
31+
'TRIGGER','TYPE','TYPE BODY','VIEW')
32+
and obj.owner = USER
33+
group by obj.owner
34+
,obj.object_name
35+
,obj.object_type
36+
,q1.max_start_dtm
37+
order by obj.owner
38+
,obj.object_name
39+
,obj.object_type;

src/core/install.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ grant select, insert, update, delete on plsql_profiler_data to public;
132132
grant select on plsql_profiler_runnumber to public;
133133
-- Core Tables
134134
@wt_test_runs.tab
135+
@wt_test_runs_summary.tab
135136
@wt_results.tab
136137
@wt_dbout_profiles.tab
137138
@wt_self_test.tab

src/core/wt_test_runs_summary.tab

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
--
3+
-- Test Runs Summary Table Installation
4+
--
5+
6+
create table wt_test_runs_summary
7+
(id number(38) constraint wt_test_runs_summary_nn1 not null
8+
,tot_cnt number
9+
,fail_cnt number
10+
,err_cnt number
11+
,tcase_cnt number
12+
,min_msec number
13+
,avg_msec number
14+
,max_msec number
15+
,std_msec number
16+
,tot_lines number
17+
,exec_lines number
18+
,anno_lines number
19+
,excl_lines number
20+
,notx_lines number
21+
,unkn_lines number
22+
,min_usec number
23+
,avg_usec number
24+
,max_usec number
25+
,std_usec number
26+
,constraint wt_test_runs_summary_pk primary key (id)
27+
,constraint wt_test_runs_summary_fk1 foreign key (id)
28+
references wt_test_runs (id)
29+
) pctfree 0;
30+
31+
comment on table wt_test_runs_summary is 'Test Run data summaries for each execution of the WTPLSQL_RUN procedure.';
32+
comment on column wt_test_runs_summary.id is 'Primary (Surrogate) Key for each Test Run. Also the Test Runs foreign key.';
33+
comment on column wt_test_runs_summary.tot_cnt is 'Total number of assetions.';
34+
comment on column wt_test_runs_summary.fail_cnt is 'Number of failed assertions.';
35+
comment on column wt_test_runs_summary.err_cnt is 'Number of errored assertions.';
36+
comment on column wt_test_runs_summary.tcase_cnt is 'Total number of test cases.';
37+
comment on column wt_test_runs_summary.min_msec is 'Minimum elapsed time between assertions in milliseconds';
38+
comment on column wt_test_runs_summary.avg_msec is 'Average elapsed time between assertions in milliseconds';
39+
comment on column wt_test_runs_summary.max_msec is 'Maximum elapsed time between assertions in milliseconds';
40+
comment on column wt_test_runs_summary.std_msec is 'Standard deviation in elapsed time between assertions in milliseconds';
41+
comment on column wt_test_runs_summary.tot_lines is 'Total number of source lines as counted by DBMS_PROFILER';
42+
comment on column wt_test_runs_summary.exec_lines is 'Number of source lines actually executed';
43+
comment on column wt_test_runs_summary.anno_lines is 'Number of source lines annotated as uncountable';
44+
comment on column wt_test_runs_summary.excl_lines is 'Number of source lines excluded due to unexplained DBMS_PROFILER metrics';
45+
comment on column wt_test_runs_summary.notx_lines is 'Number of source lines not executed';
46+
comment on column wt_test_runs_summary.unkn_lines is 'Number of source lines that have unexplained DBMS_PROFILER metrics';
47+
comment on column wt_test_runs_summary.min_usec is 'Minumum execution time for a line of source in microseconds';
48+
comment on column wt_test_runs_summary.avg_usec is 'Average execution time for a line of source in microseconds';
49+
comment on column wt_test_runs_summary.max_usec is 'Maximum execution time for a line of source in microseconds';
50+
comment on column wt_test_runs_summary.std_usec is 'Standard deviation in execution time for a line of source in microseconds';
51+
52+
grant select on wt_test_runs_summary to public;
53+
grant insert on wt_test_runs_summary to public;
54+
grant delete on wt_test_runs_summary to public;

src/core/wtplsql.pkb

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,81 @@ $THEN
204204
$END ----------------%WTPLSQL_end_ignore_lines%----------------
205205

206206

207+
------------------------------------------------------------
208+
procedure insert_test_run_summary
209+
is
210+
PRAGMA AUTONOMOUS_TRANSACTION;
211+
cursor c_results (in_test_run_id in number) is
212+
select count(*) TOT_CNT
213+
,sum(decode(status,'FAIL',1,0)) FAIL_CNT
214+
,sum(decode(status,'ERR',1,0)) ERR_CNT
215+
,count(distinct testcase) TCASE_CNT
216+
,min(elapsed_msecs) MIN_MSEC
217+
,round(avg(elapsed_msecs),3) AVG_MSEC
218+
,max(elapsed_msecs) MAX_MSEC
219+
,stddev(elapsed_msecs) STD_MSEC
220+
from wt_results
221+
where test_run_id = in_test_run_id;
222+
b_results c_results%ROWTYPE;
223+
cursor c_profiles (in_test_run_id in number) is
224+
select count(*) TOT_LINES
225+
,sum(decode(status,'EXEC',1,0)) EXEC_LINES
226+
,sum(decode(status,'ANNO',1,0)) ANNO_LINES
227+
,sum(decode(status,'EXCL',1,0)) EXCL_LINES
228+
,sum(decode(status,'NOTX',1,0)) NOTX_LINES
229+
,sum(decode(status,'UNKN',1,0)) UNKN_LINES
230+
,min(min_usecs) MIN_USEC
231+
,sum(total_usecs)/count(*) AVG_USEC
232+
,max(max_usecs) MAX_USEC
233+
,stddev(max_usecs) STD_USEC
234+
from wt_dbout_profiles
235+
where test_run_id = in_test_run_id;
236+
b_profiles c_profiles%ROWTYPE;
237+
l_wt_test_runs_summary_rec wt_test_runs_summary%ROWTYPE;
238+
begin
239+
--
240+
if g_test_runs_rec.id is null
241+
then
242+
return;
243+
end if;
244+
--
245+
open c_results(g_test_runs_rec.id);
246+
fetch c_results into b_results;
247+
close c_results;
248+
l_wt_test_runs_summary_rec.tot_cnt := b_results.tot_cnt;
249+
l_wt_test_runs_summary_rec.fail_cnt := b_results.fail_cnt;
250+
l_wt_test_runs_summary_rec.err_cnt := b_results.err_cnt;
251+
l_wt_test_runs_summary_rec.tcase_cnt := b_results.tcase_cnt;
252+
l_wt_test_runs_summary_rec.min_msec := b_results.min_msec;
253+
l_wt_test_runs_summary_rec.avg_msec := b_results.avg_msec;
254+
l_wt_test_runs_summary_rec.max_msec := b_results.max_msec;
255+
l_wt_test_runs_summary_rec.std_msec := b_results.std_msec;
256+
--
257+
open c_profiles(g_test_runs_rec.id);
258+
fetch c_profiles into b_profiles;
259+
close c_profiles;
260+
l_wt_test_runs_summary_rec.tot_lines := b_profiles.tot_lines;
261+
l_wt_test_runs_summary_rec.exec_lines := b_profiles.exec_lines;
262+
l_wt_test_runs_summary_rec.anno_lines := b_profiles.anno_lines;
263+
l_wt_test_runs_summary_rec.excl_lines := b_profiles.excl_lines;
264+
l_wt_test_runs_summary_rec.notx_lines := b_profiles.notx_lines;
265+
l_wt_test_runs_summary_rec.unkn_lines := b_profiles.unkn_lines;
266+
l_wt_test_runs_summary_rec.min_usec := b_profiles.min_usec;
267+
l_wt_test_runs_summary_rec.avg_usec := b_profiles.avg_usec;
268+
l_wt_test_runs_summary_rec.max_usec := b_profiles.max_usec;
269+
l_wt_test_runs_summary_rec.std_usec := b_profiles.std_usec;
270+
--
271+
insert into wt_test_runs_summary values l_wt_test_runs_summary_rec;
272+
COMMIT;
273+
--
274+
exception
275+
when OTHERS
276+
then
277+
DBMS_OUTPUT.PUT_LINE(dbms_utility.format_error_stack ||
278+
dbms_utility.format_error_backtrace);
279+
end insert_test_run_summary;
280+
281+
207282
---------------------
208283
-- Public Procedures
209284
---------------------
@@ -315,9 +390,10 @@ begin
315390
end;
316391

317392
-- Finalize
318-
insert_test_run; -- Autonomous Transaction COMMIT
319-
wt_result.finalize; -- Autonomous Transaction COMMIT
320-
wt_profiler.finalize; -- Autonomous Transaction COMMIT
393+
insert_test_run; -- Autonomous Transaction COMMIT
394+
wt_result.finalize; -- Autonomous Transaction COMMIT
395+
wt_profiler.finalize; -- Autonomous Transaction COMMIT
396+
insert_test_run_summary; -- Autonomous Transaction COMMIT
321397

322398
exception
323399
when OTHERS

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy