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

Skip to content

Commit 453fbff

Browse files
committed
Improved coverage reporting on suite manager.
Fixed issue with test package not getting dropped after tests. Adding spooling of tests results.
1 parent 8b19cc5 commit 453fbff

3 files changed

Lines changed: 22 additions & 26 deletions

File tree

.travis/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ alter user $UT3_OWNER identified by $UT3_OWNER_PASSWORD;
1717
--needed for Mystats script to work
1818
grant select any dictionary to $UT3_OWNER;
1919
--Needed for testing a coverage outside ut3_owner.
20-
grant create any procedure, execute any procedure to $UT3_OWNER;
20+
grant create any procedure, drop any procedure, execute any procedure to $UT3_OWNER;
2121
2222
set feedback off
2323
@../source/create_utplsql_owner.sql $UT3_USER $UT3_USER_PASSWORD $UT3_TABLESPACE

source/core/ut_suite_manager.pkb

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,11 @@ create or replace package body ut_suite_manager is
9090

9191
if l_annotation_data.package_annotations.exists('rollback') then
9292
l_suite_rollback_annotation := l_annotation_data.package_annotations('rollback').text;
93-
l_suite_rollback := case lower(l_suite_rollback_annotation)
94-
when 'manual' then
95-
ut_utils.gc_rollback_manual
96-
when 'auto' then
97-
ut_utils.gc_rollback_auto
98-
else
99-
ut_utils.gc_rollback_auto
100-
end;
93+
if lower(l_suite_rollback_annotation) = 'manual' then
94+
l_suite_rollback := ut_utils.gc_rollback_manual;
95+
else
96+
l_suite_rollback := ut_utils.gc_rollback_auto;
97+
end if;
10198
else
10299
l_suite_rollback := ut_utils.gc_rollback_auto;
103100
end if;
@@ -158,16 +155,13 @@ create or replace package body ut_suite_manager is
158155

159156
if l_proc_annotations.exists('rollback') then
160157
l_rollback_annotation := l_proc_annotations('rollback').text;
161-
l_rollback_type := case lower(l_rollback_annotation)
162-
when 'manual' then
163-
ut_utils.gc_rollback_manual
164-
when 'auto' then
165-
ut_utils.gc_rollback_auto
166-
--when 'on-error' then
167-
-- ut_utils.gc_rollback_on_error
168-
else
169-
l_suite_rollback
170-
end;
158+
if lower(l_rollback_annotation) = 'manual' then
159+
l_rollback_type := ut_utils.gc_rollback_manual;
160+
elsif lower(l_rollback_annotation) = 'auto' then
161+
l_rollback_type := ut_utils.gc_rollback_auto;
162+
else
163+
l_rollback_type := l_suite_rollback;
164+
end if;
171165
end if;
172166

173167
l_test := ut_test(a_object_owner => l_owner_name
@@ -333,9 +327,8 @@ create or replace package body ut_suite_manager is
333327
begin
334328
-- Currently cache invalidation on DDL is not implemented so schema is rescaned each time
335329
l_schema_info := get_schema_info(a_schema_name);
336-
if not g_schema_suites.exists(a_schema_name) or g_schema_suites(a_schema_name)
337-
.changed_at <= l_schema_info.changed_at
338-
or g_schema_suites(a_schema_name).obj_cnt != l_schema_info.obj_cnt then
330+
if not g_schema_suites.exists(a_schema_name) or g_schema_suites(a_schema_name).changed_at <= l_schema_info.changed_at or
331+
g_schema_suites(a_schema_name).obj_cnt != l_schema_info.obj_cnt then
339332
ut_utils.debug_log('Rescanning schema ' || a_schema_name);
340333
config_schema(a_schema_name);
341334
end if;
@@ -354,9 +347,6 @@ create or replace package body ut_suite_manager is
354347
procedure populate_suite_ut_packages(a_suite ut_logical_suite, a_packages in out nocopy ut_object_names) is
355348
l_sub_suite ut_logical_suite;
356349
begin
357-
if a_packages is null then
358-
a_packages := ut_object_names();
359-
end if;
360350
if a_suite is of (ut_suite) then
361351
a_packages.extend;
362352
a_packages(a_packages.last) := ut_object_name(a_suite.object_owner, a_suite.object_name);

tests/RunAll.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ set longchunksize 1000000
1010
set serveroutput on size unlimited format truncated
1111
@@lib/RunVars.sql
1212

13+
@@lib/mystats/mystats start
14+
15+
spool RunAll.log
16+
1317
--Global setup
1418
@@helpers/ut_example_tests.pks
1519
@@helpers/ut_example_tests.pkb
@@ -32,7 +36,6 @@ create table ut$test_table (val varchar2(1));
3236
--Start coverage in develop mode (coverage for utPLSQL framework)
3337
--Regular coverage excludes the framework
3438
exec ut_coverage.coverage_start_develop();
35-
@@lib/mystats/mystats start
3639

3740
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.IgnoreWrappedPackageAndDoesNotRaiseException.sql
3841
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParseAnnotationMixedWithWrongBeforeProcedure.sql
@@ -263,6 +266,8 @@ exec ut_coverage.coverage_start_develop();
263266
--Finally
264267
@@lib/RunSummary
265268

269+
spool off
270+
266271
--Global cleanup
267272
--removing objects that should not be part of coverage report
268273
drop package ut_example_tests;
@@ -276,6 +281,7 @@ drop package test_package_2;
276281
drop package test_package_3;
277282
drop type utplsql_test_reporter;
278283
drop package test_reporters;
284+
drop package ut3$user#.html_coverage_test;
279285

280286
set timing on
281287
prompt Generating coverage data to reporter outputs

0 commit comments

Comments
 (0)