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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e41d6f9
Interim commit with lots of dirty code - got to a place where I get t…
jgebal Oct 30, 2018
f475b7c
Added `suite_cache`.
jgebal Nov 2, 2018
4dc48e6
Interim commit - performance check on Travis.
jgebal Nov 4, 2018
1611e09
Interim commit some fixes to old tests, examples and code itself.
jgebal Nov 4, 2018
15163a8
Resolved issue with sorting of nested-tables.
jgebal Nov 4, 2018
1b14bb5
Fixing re-enabled test.
jgebal Nov 4, 2018
3bc8da5
Adding missing items to uninstall.
jgebal Nov 4, 2018
8911f97
Small improvements and cleanup.
jgebal Nov 5, 2018
a1f6b34
Removing duplicate with block.
jgebal Nov 6, 2018
59f7738
Adding cache cleanup and "intelligent" join to all_source, only when …
jgebal Nov 11, 2018
cb9cf97
Resolving some sonar violations.
jgebal Nov 11, 2018
8779025
Moving away from full outer join.
jgebal Nov 11, 2018
b3e98be
Reorganizing code a bit.
jgebal Nov 11, 2018
64dfb41
Output buffer&reporters performance improvements
jgebal Nov 12, 2018
9ea805b
Increased fetch size for coverage sources tmp seeding.
jgebal Nov 12, 2018
248bf8c
Small refactoring.
jgebal Nov 13, 2018
8fc2ea6
Further optimizations to suite parsing.
jgebal Nov 15, 2018
3543e3d
Disabled `PLSQL_OPTIMIZE_LEVEL=0` for testing
jgebal Nov 15, 2018
23c0557
Fixed formal parameter names
jgebal Nov 15, 2018
f7f6811
Revert "Disabled `PLSQL_OPTIMIZE_LEVEL=0` for testing"
jgebal Nov 15, 2018
d002d18
Refactored procedure `get_unit_test_info` to return more relevant inf…
jgebal Nov 16, 2018
e1f1eec
Renamed `get_unit_test_info` to `get_suites_info` - the latter one wa…
jgebal Nov 16, 2018
d8d251f
Improved automation of `refresh_sources.sh`
jgebal Nov 16, 2018
eb3df21
Fixing failing test.
jgebal Nov 16, 2018
d211348
Added control over rollback behavior in `ut_runner.run`
jgebal Nov 17, 2018
f342195
Reverting rollback changes - they should go as a separate PR.
jgebal Nov 17, 2018
eeae79b
Added documentation for new functionality.
jgebal Nov 17, 2018
74ec9a1
Removed unused code.
jgebal Nov 18, 2018
44d61d9
Recovering exception handlers as they are needed for handling invalid…
jgebal Nov 18, 2018
360a889
Moved some of old tests into new tests.
jgebal Nov 18, 2018
0ee3ce2
Added missing endcontext in `test_ut_test`
jgebal Nov 18, 2018
48aa338
Removed unused constants.
jgebal Nov 18, 2018
b33aaae
Added additional test for display of parser warnings.
jgebal Nov 18, 2018
e8ea644
Merge branch 'develop' into feature/suite_query_api
jgebal Nov 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Small improvements and cleanup.
  • Loading branch information
jgebal committed Nov 5, 2018
commit 8911f974e6d832f90cb0213f93df88ba53636f3a
61 changes: 31 additions & 30 deletions source/core/annotations/ut_annotation_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,18 @@ create or replace package body ut_annotation_manager as
begin
open l_result for
q'[select s.name, s.text
from ]'||l_sources_view||q'[ s
where s.type = :a_object_type
and s.owner = :a_object_owner
and s.name
in (select x.name
from ]'||l_sources_view||q'[ x
where x.type = :a_object_type
and x.owner = :a_object_owner
and x.text like '%--%\%%' escape '\'
)
order by name, line]'
from (select s.name, s.text, s.line,
max(case when s.text like '%--%\%%' escape '\'
and regexp_like(s.text,'--\s*%')
then 'Y' else 'N' end
)
over(partition by s.name) is_annotated
from ]'||l_sources_view||q'[ s
where s.type = :a_object_type
and s.owner = :a_object_owner
) s
where s.is_annotated = 'Y'
order by s.name, s.line]'
using a_object_type, a_object_owner, a_object_type, a_object_owner;

return l_result;
Expand All @@ -81,25 +82,25 @@ create or replace package body ut_annotation_manager as
begin
l_card := ut_utils.scale_cardinality(cardinality(a_objects_to_refresh));
open l_result for
q'[select /*+ cardinality( r ]'||l_card||q'[ )*/
s.name, s.text
from table(:a_objects_to_refresh) r
join ]'||l_sources_view||q'[ s
on s.name = r.object_name
where s.type = :a_object_type
and s.owner = :a_object_owner
and s.name
in (select /*+ cardinality( t ]'||l_card||q'[ )*/
x.name
from table(:a_objects_to_refresh) t
join ]'||l_sources_view||q'[ x
on x.name = t.object_name
where x.type = :a_object_type
and x.owner = :a_object_owner
and x.text like '%--%\%%' escape '\'
)
order by name, line]'
using a_objects_to_refresh, a_object_type, a_object_owner, a_objects_to_refresh, a_object_type, a_object_owner;
q'[select s.name, s.text
from (select /*+ cardinality( r ]'||l_card||q'[ )*/
s.name, s.text, s.line,
max(case when s.text like '%--%\%%' escape '\'
and regexp_like(s.text,'--\s*%')
then 'Y' else 'N' end
)
over(partition by s.name) is_annotated
from table(:a_objects_to_refresh) r
join ]'||l_sources_view||q'[ s
on s.name = r.object_name
and s.owner = r.object_owner
and s.type = r.object_type
where s.type = :a_object_type
and s.owner = :a_object_owner
) s
where s.is_annotated = 'Y'
order by s.name, s.line]'
using a_objects_to_refresh, a_object_type, a_object_owner;

return l_result;
end;
Expand Down
19 changes: 0 additions & 19 deletions source/core/types/ut_logical_suites.tps

This file was deleted.

219 changes: 95 additions & 124 deletions source/core/ut_suite_builder.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -517,32 +517,6 @@ create or replace package body ut_suite_builder is
a_suite_items( a_suite_items.last ) := l_test;
end;

procedure propagate_before_after_each(
a_suite in out nocopy ut_logical_suite,
a_before_each_list tt_executables,
a_after_each_list tt_executables
) is
l_test ut_test;
l_context ut_logical_suite;
begin
if a_suite.items is not null then
for i in 1 .. a_suite.items.count loop
if a_suite.items(i) is of (ut_test) then
l_test := treat( a_suite.items(i) as ut_test);
l_test.before_each_list := convert_list(a_before_each_list) multiset union all l_test.before_each_list;
set_seq_no(l_test.before_each_list);
l_test.after_each_list := l_test.after_each_list multiset union all convert_list(a_after_each_list);
set_seq_no(l_test.after_each_list);
a_suite.items(i) := l_test;
elsif a_suite.items(i) is of (ut_logical_suite) then
l_context := treat(a_suite.items(i) as ut_logical_suite);
propagate_before_after_each( l_context, a_before_each_list, a_after_each_list);
a_suite.items(i) := l_context;
end if;
end loop;
end if;
end;

procedure propagate_before_after_each(
a_suite_items in out nocopy ut_suite_items,
a_before_each_list tt_executables,
Expand Down Expand Up @@ -929,113 +903,110 @@ create or replace package body ut_suite_builder is
a_suite_data_cursor sys_refcursor
) is
type t_item_levels is table of ut_suite_items index by binary_integer;
c_bulk_limit constant pls_integer := 1000;
l_items_at_level t_item_levels;
l_rows tt_cached_suites;
l_tests ut_suite_items := ut_suite_items();
l_logical_suites ut_logical_suites := ut_logical_suites();
l_test ut_test;
l_logical_suite ut_logical_suite;
l_level pls_integer;
l_prev_level pls_integer;
l_idx integer;
begin
a_suites := ut_suite_items();
loop
if l_idx is null then
fetch a_suite_data_cursor bulk collect into l_rows limit 1000;
l_tests.delete;
l_tests.extend(l_rows.count);
l_logical_suites.delete;
l_logical_suites.extend(l_rows.count);
for i in 1 .. l_rows.count loop
case l_rows(i).self_type
when 'UT_TEST' then
l_tests(i) :=
ut_test(
self_type => l_rows(i).self_type,
object_owner => l_rows(i).object_owner, object_name => lower(l_rows(i).object_name),
name => lower(l_rows(i).name), description => l_rows(i).description, path => l_rows(i).path,
rollback_type => l_rows(i).rollback_type, disabled_flag => l_rows(i).disabled_flag,
line_no => l_rows(i).line_no, parse_time => l_rows(i).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(i).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
before_each_list => sort_by_seq_no(l_rows(i).before_each_list), before_test_list => sort_by_seq_no(l_rows(i).before_test_list),
item => l_rows(i).item,
after_test_list => sort_by_seq_no(l_rows(i).after_test_list), after_each_list => sort_by_seq_no(l_rows(i).after_each_list),
all_expectations => ut_expectation_results(), failed_expectations => ut_expectation_results(),
parent_error_stack_trace => null, expected_error_codes => l_rows(i).expected_error_codes
);
when 'UT_SUITE' then
l_logical_suites(i) :=
ut_suite(
self_type => l_rows(i).self_type,
object_owner => l_rows(i).object_owner, object_name => lower(l_rows(i).object_name),
name => lower(l_rows(i).name), description => l_rows(i).description, path => l_rows(i).path,
rollback_type => l_rows(i).rollback_type, disabled_flag => l_rows(i).disabled_flag,
line_no => l_rows(i).line_no, parse_time => l_rows(i).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(i).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no(l_rows(i).before_all_list), after_all_list => sort_by_seq_no(l_rows(i).after_all_list)
);
when 'UT_SUITE_CONTEXT' then
l_logical_suites(i) :=
ut_suite_context(
self_type => l_rows(i).self_type,
object_owner => l_rows(i).object_owner, object_name => lower(l_rows(i).object_name),
name => lower(l_rows(i).name), description => l_rows(i).description, path => l_rows(i).path,
rollback_type => l_rows(i).rollback_type, disabled_flag => l_rows(i).disabled_flag,
line_no => l_rows(i).line_no, parse_time => l_rows(i).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(i).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no(l_rows(i).before_all_list), after_all_list => sort_by_seq_no(l_rows(i).after_all_list)
);
when 'UT_LOGICAL_SUITE' then
l_logical_suites(i) :=
ut_logical_suite(
self_type => l_rows(i).self_type,
object_owner => l_rows(i).object_owner, object_name => lower(l_rows(i).object_name),
name => lower(l_rows(i).name), description => l_rows(i).description, path => l_rows(i).path,
rollback_type => l_rows(i).rollback_type, disabled_flag => l_rows(i).disabled_flag,
line_no => l_rows(i).line_no, parse_time => l_rows(i).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(i).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items()
);
end case;
end loop;
l_idx := l_rows.first;
end if;
exit when l_idx is null;
l_level := length(l_rows(l_idx).path) - length( replace(l_rows(l_idx).path, '.') ) + 1;
fetch a_suite_data_cursor bulk collect into l_rows limit c_bulk_limit;
exit when l_rows.count = 0;

if l_level > 1 then
if l_prev_level > l_level then
l_logical_suites(l_idx).items := l_items_at_level(l_prev_level);
l_items_at_level(l_prev_level).delete;
end if;
if not l_items_at_level.exists(l_level) then
l_items_at_level(l_level) := ut_suite_items();
end if;
l_items_at_level(l_level).extend;
if l_tests(l_idx) is not null then
l_items_at_level(l_level)(l_items_at_level(l_level).last) := l_tests(l_idx);
else
l_items_at_level(l_level)(l_items_at_level(l_level).last) := l_logical_suites(l_idx);
end if;
else
if l_prev_level > l_level then
l_logical_suites(l_idx).items := l_items_at_level(l_prev_level);
l_items_at_level(l_prev_level).delete;
end if;
a_suites.extend;
if l_tests(l_idx) is not null then
a_suites(a_suites.last) := l_tests(l_idx);
l_idx := l_rows.first;
loop
l_test := null;
l_logical_suite := null;
case l_rows(l_idx).self_type
when 'UT_TEST' then
l_test :=
ut_test(
self_type => l_rows(l_idx).self_type,
object_owner => l_rows(l_idx).object_owner, object_name => lower(l_rows(l_idx).object_name),
name => lower(l_rows(l_idx).name), description => l_rows(l_idx).description, path => l_rows(l_idx).path,
rollback_type => l_rows(l_idx).rollback_type, disabled_flag => l_rows(l_idx).disabled_flag,
line_no => l_rows(l_idx).line_no, parse_time => l_rows(l_idx).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(l_idx).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
before_each_list => sort_by_seq_no(l_rows(l_idx).before_each_list), before_test_list => sort_by_seq_no(l_rows(l_idx).before_test_list),
item => l_rows(l_idx).item,
after_test_list => sort_by_seq_no(l_rows(l_idx).after_test_list), after_each_list => sort_by_seq_no(l_rows(l_idx).after_each_list),
all_expectations => ut_expectation_results(), failed_expectations => ut_expectation_results(),
parent_error_stack_trace => null, expected_error_codes => l_rows(l_idx).expected_error_codes
);
when 'UT_SUITE' then
l_logical_suite :=
ut_suite(
self_type => l_rows(l_idx).self_type,
object_owner => l_rows(l_idx).object_owner, object_name => lower(l_rows(l_idx).object_name),
name => lower(l_rows(l_idx).name), description => l_rows(l_idx).description, path => l_rows(l_idx).path,
rollback_type => l_rows(l_idx).rollback_type, disabled_flag => l_rows(l_idx).disabled_flag,
line_no => l_rows(l_idx).line_no, parse_time => l_rows(l_idx).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(l_idx).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no(l_rows(l_idx).before_all_list), after_all_list => sort_by_seq_no(l_rows(l_idx).after_all_list)
);
when 'UT_SUITE_CONTEXT' then
l_logical_suite :=
ut_suite_context(
self_type => l_rows(l_idx).self_type,
object_owner => l_rows(l_idx).object_owner, object_name => lower(l_rows(l_idx).object_name),
name => lower(l_rows(l_idx).name), description => l_rows(l_idx).description, path => l_rows(l_idx).path,
rollback_type => l_rows(l_idx).rollback_type, disabled_flag => l_rows(l_idx).disabled_flag,
line_no => l_rows(l_idx).line_no, parse_time => l_rows(l_idx).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(l_idx).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no(l_rows(l_idx).before_all_list), after_all_list => sort_by_seq_no(l_rows(l_idx).after_all_list)
);
when 'UT_LOGICAL_SUITE' then
l_logical_suite :=
ut_logical_suite(
self_type => l_rows(l_idx).self_type,
object_owner => l_rows(l_idx).object_owner, object_name => lower(l_rows(l_idx).object_name),
name => lower(l_rows(l_idx).name), description => l_rows(l_idx).description, path => l_rows(l_idx).path,
rollback_type => l_rows(l_idx).rollback_type, disabled_flag => l_rows(l_idx).disabled_flag,
line_no => l_rows(l_idx).line_no, parse_time => l_rows(l_idx).parse_time,
start_time => null, end_time => null, result => null, warnings => l_rows(l_idx).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items()
);
end case;

l_level := length(l_rows(l_idx).path) - length( replace(l_rows(l_idx).path, '.') ) + 1;

if l_level > 1 then
if l_prev_level > l_level then
l_logical_suite.items := l_items_at_level(l_prev_level);
l_items_at_level(l_prev_level).delete;
end if;
if not l_items_at_level.exists(l_level) then
l_items_at_level(l_level) := ut_suite_items();
end if;
l_items_at_level(l_level).extend;
if l_test is not null then
l_items_at_level(l_level)(l_items_at_level(l_level).last) := l_test;
else
l_items_at_level(l_level)(l_items_at_level(l_level).last) := l_logical_suite;
end if;
else
a_suites(a_suites.last) := l_logical_suites(l_idx);
if l_prev_level > l_level then
l_logical_suite.items := l_items_at_level(l_prev_level);
l_items_at_level(l_prev_level).delete;
end if;
a_suites.extend;
a_suites(a_suites.last) := l_logical_suite;
end if;
end if;
l_prev_level := l_level;
l_idx := l_rows.next(l_idx);
l_prev_level := l_level;
l_idx := l_rows.next(l_idx);
exit when l_idx is null;
end loop;
exit when l_rows.count < c_bulk_limit;
end loop;
copy_list_reverse_order( a_suites );
close a_suite_data_cursor;
Expand Down Expand Up @@ -1066,7 +1037,7 @@ create or replace package body ut_suite_builder is
open l_result for
q'[with
suite_items as (
select c.*
select /*+ cardinality(c 100) */ c.*
from ]'||l_ut_owner||q'[.ut_suite_cache c
where 1 = 1 ]'||case when not a_skip_all_objects then q'[
and exists
Expand All @@ -1093,7 +1064,7 @@ create or replace package body ut_suite_builder is
),
gen as (
select rownum as pos
from xmltable('1 to 100')
from xmltable('1 to 20')
),
suitepaths as (
select distinct substr(path,1,instr(path,'.',-1)-1) as suitepath,
Expand Down
1 change: 0 additions & 1 deletion source/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ alter session set current_schema = &&ut3_owner;
@@install_component.sql 'core/types/ut_executable_test.tps'
@@install_component.sql 'core/types/ut_test.tps'
@@install_component.sql 'core/types/ut_logical_suite.tps'
@@install_component.sql 'core/types/ut_logical_suites.tps'
@@install_component.sql 'core/types/ut_suite.tps'
@@install_component.sql 'core/types/ut_suite_context.tps'
@@install_component.sql 'core/types/ut_file_mapping.tps'
Expand Down