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
Added additional test for display of parser warnings.
Fixed issue with warnings not getting shown.
  • Loading branch information
jgebal committed Nov 18, 2018
commit b33aaaee70db13038760f8401c101767b80e2309
201 changes: 102 additions & 99 deletions source/core/ut_suite_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -174,91 +174,112 @@ create or replace package body ut_suite_manager is
a_level pls_integer,
a_prev_level pls_integer,
a_items_at_level t_item_levels
) return ut_logical_suite is
) return ut_suite_item is
l_result ut_suite_item;
begin
return
case a_rows( a_idx ).self_type
when 'UT_SUITE' then
case when a_prev_level > a_level then
ut_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => a_items_at_level(a_prev_level),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
else
ut_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
end
l_result :=
case when a_prev_level > a_level then
ut_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => a_items_at_level(a_prev_level),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
else
ut_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
end;
when 'UT_SUITE_CONTEXT' then
case when a_prev_level > a_level then
ut_suite_context(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => a_items_at_level(a_prev_level),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
else
ut_suite_context(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
end
l_result :=
case when a_prev_level > a_level then
ut_suite_context(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => a_items_at_level(a_prev_level),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
else
ut_suite_context(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items(),
before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
a_rows( a_idx ).after_all_list)
)
end;
when 'UT_LOGICAL_SUITE' then
case when a_prev_level > a_level then
ut_logical_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => a_items_at_level(a_prev_level)
)
else
ut_logical_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
l_result :=
case when a_prev_level > a_level then
ut_logical_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => a_items_at_level(a_prev_level)
)
else
ut_logical_suite(
self_type => a_rows( a_idx ).self_type,
object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag,
line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items()
)
end;
when 'UT_TEST' then
l_result :=
ut_test(
self_type => a_rows(a_idx).self_type,
object_owner => a_rows(a_idx).object_owner, object_name => lower(a_rows(a_idx).object_name),
name => lower(a_rows(a_idx).name), description => a_rows(a_idx).description, path => a_rows(a_idx).path,
rollback_type => a_rows(a_idx).rollback_type, disabled_flag => a_rows(a_idx).disabled_flag,
line_no => a_rows(a_idx).line_no, parse_time => a_rows(a_idx).parse_time,
start_time => null, end_time => null, result => null, warnings => a_rows(a_idx).warnings,
results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
items => ut_suite_items()
)
end
end;
before_each_list => sort_by_seq_no(a_rows(a_idx).before_each_list), before_test_list => sort_by_seq_no(a_rows(a_idx).before_test_list),
item => a_rows(a_idx).item,
after_test_list => sort_by_seq_no(a_rows(a_idx).after_test_list), after_each_list => sort_by_seq_no(a_rows(a_idx).after_each_list),
all_expectations => ut_expectation_results(), failed_expectations => ut_expectation_results(),
parent_error_stack_trace => null, expected_error_codes => a_rows(a_idx).expected_error_codes
);
end case;
l_result.results_count.warnings_count := l_result.warnings.count;
return l_result;
end;

procedure reconstruct_from_cache(
Expand All @@ -283,26 +304,8 @@ create or replace package body ut_suite_manager is
l_items_at_level(l_level) := ut_suite_items();
end if;
l_items_at_level(l_level).extend;
if l_rows(l_idx).self_type = 'UT_TEST' then
l_items_at_level(l_level)(l_items_at_level(l_level).last) :=
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
);
else
pragma inline(get_logical_suite, 'YES');
l_items_at_level(l_level)(l_items_at_level(l_level).last) := get_logical_suite(l_rows, l_idx, l_level,l_prev_level, l_items_at_level );
end if;
pragma inline(get_logical_suite, 'YES');
l_items_at_level(l_level)(l_items_at_level(l_level).last) := get_logical_suite(l_rows, l_idx, l_level,l_prev_level, l_items_at_level );
else
a_suites.extend;
pragma inline(get_logical_suite, 'YES');
Expand Down
42 changes: 40 additions & 2 deletions test/api/test_ut_run.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,45 @@ Failures:%
begin
execute immediate 'drop package invalid_pckag_that_revalidates';
execute immediate 'drop package parent_specs';
end;

end;

procedure run_and_report_warnings is
l_results ut3.ut_varchar2_list;
l_actual clob;
begin

select * bulk collect into l_results from table(ut3.ut.run('bad_annotations'));
l_actual := ut3.ut_utils.table_to_clob(l_results);

ut.expect(l_actual).to_be_like('%Invalid annotation "--%context". Cannot find following "--%endcontext". Annotation ignored.%
%1 tests, 0 failed, 0 errored, 0 disabled, 1 warning(s)%');

end;

procedure create_bad_annot is
pragma autonomous_transaction;
begin
execute immediate q'[
create or replace package bad_annotations as
--%suite

--%context

--%test(invalidspecs)
procedure test1;

end;]';

execute immediate q'[
create or replace package body bad_annotations as
procedure test1 is begin ut.expect(1).to_equal(1); end;
end;]';

end;
procedure drop_bad_annot is
pragma autonomous_transaction;
begin
execute immediate 'drop package bad_annotations';
end;
end;
/
6 changes: 6 additions & 0 deletions test/api/test_ut_run.pks
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ create or replace package test_ut_run is
procedure generate_invalid_spec;
procedure drop_invalid_spec;

--%test(Provides warnings on invalid annotations)
--%beforetest(create_bad_annot)
--%aftertest(drop_bad_annot)
procedure run_and_report_warnings;
procedure create_bad_annot;
procedure drop_bad_annot;
--%endcontext

end;
Expand Down