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
30 commits
Select commit Hold shift + click to select a range
c787e47
Added support for multiple occurrences of before and after blocks.
jgebal Mar 4, 2018
2399981
tmp
jgebal Mar 14, 2018
2631355
Fixed issue with null items list.
jgebal Mar 15, 2018
a05475a
Redefined event listeners mechanism.
jgebal Mar 25, 2018
f955d2a
Redefined event listeners mechanism.
jgebal Mar 25, 2018
430f76f
Fixed minor bug in XUnit reporter (showing CDATA for errors even when…
jgebal Mar 25, 2018
2537ced
Changed propagation of rollback. Now rollback will propagate from par…
jgebal Mar 29, 2018
9308662
Fixed examples.
jgebal Mar 29, 2018
17ee8cb
Fixed test for empty description in 11g.
jgebal Mar 29, 2018
93be873
Fixed test for empty description in 11g.
jgebal Mar 29, 2018
75b96c3
Fixed double warning on missing endcontext annotation.
jgebal Mar 29, 2018
a6dadcc
fix in test to overcome 11g XML missing attributes in 3.0.4
jgebal Mar 30, 2018
4bc7ced
Merge branch 'develop' into feature/support_of_context
jgebal Apr 7, 2018
8a26845
Fixes after merging from develop.
jgebal Apr 7, 2018
e9c4e80
Fixed test failure on 11g R2 - some issues with LIKE operator, long p…
jgebal Apr 7, 2018
bfbfa43
Updated documentation.
jgebal Apr 7, 2018
9cd61bf
Marking first column as bold
jgebal Apr 7, 2018
1adf35d
Changed the way reporters events are registered.
jgebal Apr 14, 2018
71d0b70
Fixed issues with comment-replace in big package specs.
jgebal Apr 14, 2018
8617613
Updated test for comments removal to include multi-line comments with…
jgebal Apr 16, 2018
51ba943
Updated documentation with new and changed annotations.
jgebal Apr 16, 2018
ad3f830
Changed behaviour for duplicate annotations - first wins.
jgebal Apr 19, 2018
4346b57
Updates to documentation.
jgebal Apr 20, 2018
b1ff0fc
Updates to documentation.
jgebal Apr 20, 2018
ab5a1ca
Updated and extended documentation for annotations.
jgebal Apr 22, 2018
e672ef0
Added description of `context` to annotations documentation.
jgebal Apr 22, 2018
9897247
Merge remote-tracking branch 'origin/develop' into feature/support_of…
jgebal Apr 22, 2018
b2df93e
Integrated with develop branch changes.
jgebal Apr 22, 2018
d604127
Removed empty header from documentation.
jgebal Apr 24, 2018
9afb7be
A bit of code cleanup and tests alignment.
jgebal Apr 25, 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
Next Next commit
Added support for multiple occurrences of before and after blocks.
Refactored suite_builder to be ready for context.
  • Loading branch information
jgebal committed Mar 24, 2018
commit c787e4793de0d89ff9770320e2e863ce25142be4
19 changes: 19 additions & 0 deletions source/core/types/ut_executables.tps
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create or replace type ut_executables as
/*
utPLSQL - Version 3
Copyright 2016 - 2017 utPLSQL Project

Licensed under the Apache License, Version 2.0 (the "License"):
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
table of ut_executable
/
14 changes: 12 additions & 2 deletions source/core/types/ut_logical_suite.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ create or replace type body ut_logical_suite as
*/

constructor function ut_logical_suite(
self in out nocopy ut_logical_suite,a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_description varchar2 := null, a_path varchar2
self in out nocopy ut_logical_suite,a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_path varchar2
) return self as result is
begin
self.self_type := $$plsql_unit;
self.init(a_object_owner, a_object_name, a_name, a_description, a_path, ut_utils.gc_rollback_auto, false);
self.init(a_object_owner, a_object_name, a_name);
self.path := a_path;
self.disabled_flag := ut_utils.boolean_to_int(false);
self.items := ut_suite_items();
return;
end;
Expand Down Expand Up @@ -49,6 +51,14 @@ create or replace type body ut_logical_suite as
self.calc_execution_result();
end;

overriding member procedure set_default_rollback_type(self in out nocopy ut_logical_suite, a_rollback_type integer) is
begin
self.rollback_type := coalesce(self.rollback_type, a_rollback_type);
for i in 1 .. self.items.count loop
self.items(i).set_default_rollback_type(a_rollback_type);
end loop;
end;

overriding member function do_execute(self in out nocopy ut_logical_suite, a_listener in out nocopy ut_event_listener_base) return boolean is
l_suite_savepoint varchar2(30);
l_item_savepoint varchar2(30);
Expand Down
3 changes: 2 additions & 1 deletion source/core/types/ut_logical_suite.tps
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ create or replace type ut_logical_suite under ut_suite_item (
items ut_suite_items,

constructor function ut_logical_suite(
self in out nocopy ut_logical_suite,a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_description varchar2 := null, a_path varchar2
self in out nocopy ut_logical_suite, a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_path varchar2
) return self as result,
member function is_valid(self in out nocopy ut_logical_suite) return boolean,
member procedure add_item(self in out nocopy ut_logical_suite, a_item ut_suite_item),
overriding member procedure mark_as_skipped(self in out nocopy ut_logical_suite, a_listener in out nocopy ut_event_listener_base),
overriding member procedure set_default_rollback_type(self in out nocopy ut_logical_suite, a_rollback_type integer),
overriding member function do_execute(self in out nocopy ut_logical_suite, a_listener in out nocopy ut_event_listener_base) return boolean,
overriding member procedure calc_execution_result(self in out nocopy ut_logical_suite),
overriding member procedure mark_as_errored(self in out nocopy ut_logical_suite, a_listener in out nocopy ut_event_listener_base, a_error_stack_trace varchar2),
Expand Down
68 changes: 41 additions & 27 deletions source/core/types/ut_suite.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,31 @@ create or replace type body ut_suite as
limitations under the License.
*/

constructor function ut_suite (
self in out nocopy ut_suite , a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2, a_path varchar2, a_description varchar2 := null,
a_rollback_type integer := null, a_disabled_flag boolean := false, a_before_all_proc_name varchar2 := null,
a_after_all_proc_name varchar2 := null
) return self as result is
constructor function ut_suite (self in out nocopy ut_suite , a_object_owner varchar2, a_object_name varchar2) return self as result is
begin
self.self_type := $$plsql_unit;
self.init(a_object_owner, a_object_name, a_name, a_description, a_path, a_rollback_type, a_disabled_flag);
self.before_all := ut_executable(self, a_before_all_proc_name, ut_utils.gc_before_all);
self.init(a_object_owner, a_object_name, a_object_name);
self.items := ut_suite_items();
self.after_all := ut_executable(self, a_after_all_proc_name, ut_utils.gc_after_all);
before_all_list := ut_executables();
after_all_list := ut_executables();
return;
end;

overriding member function is_valid(self in out nocopy ut_suite) return boolean is
l_is_valid boolean;
l_is_valid boolean := true;
begin
l_is_valid :=
( not self.before_all.is_defined() or self.before_all.is_valid() ) and
( not self.after_all.is_defined() or self.after_all.is_valid() );
for i in 1 .. before_all_list.count loop
l_is_valid := self.before_all_list(i).is_valid() and l_is_valid;
end loop;
for i in 1 .. after_all_list.count loop
l_is_valid := self.after_all_list(i).is_valid() and l_is_valid;
end loop;
return l_is_valid;
end;

overriding member function do_execute(self in out nocopy ut_suite, a_listener in out nocopy ut_event_listener_base) return boolean is
l_suite_savepoint varchar2(30);
l_suite_step_without_errors boolean;
l_no_errors boolean;

procedure propagate_error(a_error_stack_trace varchar2) is
begin
Expand All @@ -64,20 +63,27 @@ create or replace type body ut_suite as
l_suite_savepoint := self.create_savepoint_if_needed();

--includes listener calls for before and after actions
l_suite_step_without_errors := self.before_all.do_execute(self, a_listener);

if l_suite_step_without_errors then
l_no_errors := true;
for i in 1 .. self.before_all_list.count loop
l_no_errors := self.before_all_list(i).do_execute(self, a_listener);
if not l_no_errors then
propagate_error(self.before_all_list(i).get_error_stack_trace());
exit;
end if;
end loop;

if l_no_errors then
for i in 1 .. self.items.count loop
self.items(i).do_execute(a_listener);
end loop;
else
propagate_error(self.before_all.get_error_stack_trace());
end if;

l_suite_step_without_errors := self.after_all.do_execute(self, a_listener);
if not l_suite_step_without_errors then
self.put_warning(self.after_all.get_error_stack_trace());
end if;
for i in 1 .. after_all_list.count loop
l_no_errors := self.after_all_list(i).do_execute(self, a_listener);
if not l_no_errors then
self.put_warning(self.after_all_list(i).get_error_stack_trace());
end if;
end loop;

self.rollback_to_savepoint(l_suite_savepoint);

Expand All @@ -91,22 +97,30 @@ create or replace type body ut_suite as

ut_utils.set_action(null);

return l_suite_step_without_errors;
return l_no_errors;
end;

overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list is
l_stack_traces ut_varchar2_list := ut_varchar2_list();
begin
ut_utils.append_to_list(l_stack_traces, self.before_all.get_error_stack_trace());
ut_utils.append_to_list(l_stack_traces, self.after_all.get_error_stack_trace());
for i in 1 .. before_all_list.count loop
ut_utils.append_to_list(l_stack_traces, self.before_all_list(i).get_error_stack_trace());
end loop;
for i in 1 .. after_all_list.count loop
ut_utils.append_to_list(l_stack_traces, self.after_all_list(i).get_error_stack_trace());
end loop;
return l_stack_traces;
end;

overriding member function get_serveroutputs return clob is
l_outputs clob;
begin
ut_utils.append_to_clob(l_outputs, self.before_all.serveroutput );
ut_utils.append_to_clob(l_outputs, self.after_all.serveroutput );
for i in 1 .. before_all_list.count loop
ut_utils.append_to_clob(l_outputs, self.before_all_list(i).serveroutput);
end loop;
for i in 1 .. after_all_list.count loop
ut_utils.append_to_clob(l_outputs, self.after_all_list(i).serveroutput);
end loop;
return l_outputs;
end;

Expand Down
10 changes: 3 additions & 7 deletions source/core/types/ut_suite.tps
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@ create or replace type ut_suite under ut_logical_suite (
* The procedure to be invoked before all of the items of the suite (executed once)
* Procedure exists within the package of the suite
*/
before_all ut_executable,
before_all_list ut_executables,

/**
* The procedure to be invoked after all of the items of the suite (executed once)
* Procedure exists within the package of the suite
*/
after_all ut_executable,
constructor function ut_suite (
self in out nocopy ut_suite , a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2, a_path varchar2, a_description varchar2 := null,
a_rollback_type integer := null, a_disabled_flag boolean := false, a_before_all_proc_name varchar2 := null,
a_after_all_proc_name varchar2 := null
) return self as result,
after_all_list ut_executables,
constructor function ut_suite (self in out nocopy ut_suite , a_object_owner varchar2, a_object_name varchar2) return self as result,
overriding member function is_valid(self in out nocopy ut_suite) return boolean,
overriding member function do_execute(self in out nocopy ut_suite , a_listener in out nocopy ut_event_listener_base) return boolean,
overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list,
Expand Down
12 changes: 7 additions & 5 deletions source/core/types/ut_suite_item.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ create or replace type body ut_suite_item as
limitations under the License.
*/

member procedure init(self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_description varchar2, a_path varchar2, a_rollback_type integer, a_disabled_flag boolean) is
member procedure init(self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2) is
begin
self.object_owner := a_object_owner;
self.object_name := lower(trim(a_object_name));
self.name := lower(trim(a_name));
self.description := a_description;
self.path := nvl(lower(trim(a_path)), self.object_name);
self.rollback_type := a_rollback_type;
self.disabled_flag := ut_utils.boolean_to_int(a_disabled_flag);
self.results_count := ut_results_counter();
self.warnings := ut_varchar2_list();
self.transaction_invalidators := ut_varchar2_list();
self.disabled_flag := ut_utils.boolean_to_int(false);
end;

member procedure set_disabled_flag(self in out nocopy ut_suite_item, a_disabled_flag boolean) is
Expand All @@ -40,6 +37,11 @@ create or replace type body ut_suite_item as
return ut_utils.int_to_boolean(self.disabled_flag);
end;

member procedure set_default_rollback_type(self in out nocopy ut_suite_item, a_rollback_type integer) is
begin
self.rollback_type := coalesce(self.rollback_type, a_rollback_type);
end;

final member procedure do_execute(self in out nocopy ut_suite_item, a_listener in out nocopy ut_event_listener_base) is
l_completed_without_errors boolean;
begin
Expand Down
5 changes: 2 additions & 3 deletions source/core/types/ut_suite_item.tps
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ create or replace type ut_suite_item force under ut_suite_item_base (

results_count ut_results_counter,
transaction_invalidators ut_varchar2_list,
member procedure init(
self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2,
a_description varchar2, a_path varchar2, a_rollback_type integer, a_disabled_flag boolean),
member procedure init(self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2),
member procedure set_disabled_flag(self in out nocopy ut_suite_item, a_disabled_flag boolean),
member function get_disabled_flag return boolean,
not instantiable member procedure mark_as_skipped(self in out nocopy ut_suite_item, a_listener in out nocopy ut_event_listener_base),
member procedure set_default_rollback_type(self in out nocopy ut_suite_item, a_rollback_type integer),
member function create_savepoint_if_needed return varchar2,
member procedure rollback_to_savepoint(self in out nocopy ut_suite_item, a_savepoint varchar2),
member function get_transaction_invalidators return ut_varchar2_list,
Expand Down
Loading