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
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
Renamed "ignore" to "disabled" in code to match the annotation naming…
… convention.
  • Loading branch information
jgebal committed Mar 16, 2017
commit fa7e8a6b7e01b18fc81e1a9f0ed5d58a786a13b1
10 changes: 5 additions & 5 deletions source/core/types/ut_logical_suite.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ create or replace type body ut_logical_suite as
a_listener.fire_before_event(ut_utils.gc_suite,self);
self.start_time := current_timestamp;

if self.get_ignore_flag() then
self.result := ut_utils.tr_ignore;
if self.get_disabled_flag() then
self.result := ut_utils.tr_disabled;
self.end_time := self.start_time;
ut_utils.debug_log('ut_logical_suite.execute - ignored');
ut_utils.debug_log('ut_logical_suite.execute - disabled');
else

self.start_time := current_timestamp;
Expand Down Expand Up @@ -114,12 +114,12 @@ create or replace type body ut_logical_suite as
self.end_time := self.start_time;
a_listener.fire_after_event(ut_utils.gc_suite, self);
end;

overriding member function get_error_stack_traces return ut_varchar2_list is
begin
return ut_varchar2_list();
end;

overriding member function get_serveroutputs return clob is
begin
return null;
Expand Down
20 changes: 10 additions & 10 deletions source/core/types/ut_results_counter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ create or replace type body ut_results_counter as
*/
constructor function ut_results_counter(self in out nocopy ut_results_counter) return self as result is
begin
self.ignored_count := 0;
self.disabled_count := 0;
self.success_count := 0;
self.failure_count := 0;
self.errored_count := 0;
Expand All @@ -27,23 +27,23 @@ create or replace type body ut_results_counter as

constructor function ut_results_counter(self in out nocopy ut_results_counter, a_status integer) return self as result is
begin
self.ignored_count := case when a_status = ut_utils.tr_ignore then 1 else 0 end;
self.success_count := case when a_status = ut_utils.tr_success then 1 else 0 end;
self.failure_count := case when a_status = ut_utils.tr_failure then 1 else 0 end;
self.errored_count := case when a_status = ut_utils.tr_error then 1 else 0 end;
self.disabled_count := case when a_status = ut_utils.tr_disabled then 1 else 0 end;
self.success_count := case when a_status = ut_utils.tr_success then 1 else 0 end;
self.failure_count := case when a_status = ut_utils.tr_failure then 1 else 0 end;
self.errored_count := case when a_status = ut_utils.tr_error then 1 else 0 end;
self.warnings_count := 0;
return;
end;

member procedure sum_counter_values(self in out nocopy ut_results_counter, a_item ut_results_counter) is
begin
self.ignored_count := self.ignored_count + a_item.ignored_count;
self.disabled_count := self.disabled_count + a_item.disabled_count;
self.success_count := self.success_count + a_item.success_count;
self.failure_count := self.failure_count + a_item.failure_count;
self.errored_count := self.errored_count + a_item.errored_count;
self.warnings_count := self.warnings_count + a_item.warnings_count;
end;

member procedure increase_warning_count(self in out nocopy ut_results_counter) is
begin
self.warnings_count := self.warnings_count + 1;
Expand All @@ -52,7 +52,7 @@ create or replace type body ut_results_counter as
member function total_count return integer is
begin
--skip warnings here
return self.ignored_count + self.success_count + self.failure_count + self.errored_count;
return self.disabled_count + self.success_count + self.failure_count + self.errored_count;
end;

member function result_status return integer is
Expand All @@ -64,8 +64,8 @@ create or replace type body ut_results_counter as
l_result := ut_utils.tr_failure;
elsif self.success_count > 0 then
l_result := ut_utils.tr_success;
elsif self.ignored_count > 0 then
l_result := ut_utils.tr_ignore;
elsif self.disabled_count > 0 then
l_result := ut_utils.tr_disabled;
else
l_result := ut_utils.tr_error;
end if;
Expand Down
8 changes: 4 additions & 4 deletions source/core/types/ut_results_counter.tps
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ create or replace type ut_results_counter as object(
See the License for the specific language governing permissions and
limitations under the License.
*/
ignored_count integer,
success_count integer,
failure_count integer,
errored_count integer,
disabled_count integer,
success_count integer,
failure_count integer,
errored_count integer,
warnings_count integer,
constructor function ut_results_counter(self in out nocopy ut_results_counter) return self as result,
constructor function ut_results_counter(self in out nocopy ut_results_counter, a_status integer) return self as result,
Expand Down
10 changes: 5 additions & 5 deletions source/core/types/ut_suite.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ create or replace type body ut_suite as

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_ignore_flag boolean := false, a_before_all_proc_name 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
begin
self.self_type := $$plsql_unit;
self.init(a_object_owner, a_object_name, a_name, a_description, a_path, a_rollback_type, a_ignore_flag);
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.items := ut_suite_items();
self.after_all := ut_executable(self, a_after_all_proc_name, ut_utils.gc_after_all);
Expand Down Expand Up @@ -56,10 +56,10 @@ create or replace type body ut_suite as

self.start_time := current_timestamp;

if self.get_ignore_flag() then
self.result := ut_utils.tr_ignore;
if self.get_disabled_flag() then
self.result := ut_utils.tr_disabled;
self.end_time := self.start_time;
ut_utils.debug_log('ut_suite .execute - ignored');
ut_utils.debug_log('ut_suite.execute - disabled');
else

if self.is_valid() then
Expand Down
2 changes: 1 addition & 1 deletion source/core/types/ut_suite.tps
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ create or replace type ut_suite under ut_logical_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_ignore_flag boolean := false, a_before_all_proc_name 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,
overriding member function is_valid(self in out nocopy ut_suite) return boolean,
Expand Down
12 changes: 6 additions & 6 deletions source/core/types/ut_suite_item.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create or replace type body ut_suite_item as

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_ignore_flag boolean
a_description varchar2, a_path varchar2, a_rollback_type integer, a_disabled_flag boolean
) is
begin
self.object_owner := a_object_owner;
Expand All @@ -27,19 +27,19 @@ create or replace type body ut_suite_item as
self.description := a_description;
self.path := nvl(lower(trim(a_path)), self.object_name);
self.rollback_type := a_rollback_type;
self.ignore_flag := ut_utils.boolean_to_int(a_ignore_flag);
self.disabled_flag := ut_utils.boolean_to_int(a_disabled_flag);
self.results_count := ut_results_counter();
self.warnings := ut_varchar2_list();
end;

member procedure set_ignore_flag(self in out nocopy ut_suite_item, a_ignore_flag boolean) is
member procedure set_disabled_flag(self in out nocopy ut_suite_item, a_disabled_flag boolean) is
begin
self.ignore_flag := ut_utils.boolean_to_int(a_ignore_flag);
self.disabled_flag := ut_utils.boolean_to_int(a_disabled_flag);
end;

member function get_ignore_flag return boolean is
member function get_disabled_flag return boolean is
begin
return ut_utils.int_to_boolean(self.ignore_flag);
return ut_utils.int_to_boolean(self.disabled_flag);
end;

final member procedure do_execute(self in out nocopy ut_suite_item, a_listener in out nocopy ut_event_listener_base) is
Expand Down
6 changes: 3 additions & 3 deletions source/core/types/ut_suite_item.tps
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ create or replace type ut_suite_item force under ut_suite_item_base (
results_count ut_results_counter,
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_ignore_flag boolean),
member procedure set_ignore_flag(self in out nocopy ut_suite_item, a_ignore_flag boolean),
member function get_ignore_flag return boolean,
a_description varchar2, a_path varchar2, a_rollback_type integer, a_disabled_flag boolean),
member procedure set_disabled_flag(self in out nocopy ut_suite_item, a_disabled_flag boolean),
member function get_disabled_flag return boolean,
member function create_savepoint_if_needed return varchar2,
member procedure rollback_to_savepoint(self in ut_suite_item, a_savepoint varchar2),
member function execution_time return number,
Expand Down
4 changes: 2 additions & 2 deletions source/core/types/ut_suite_item_base.tps
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ create or replace type ut_suite_item_base authid current_user as object (
*/
rollback_type integer(1),
/**
* Indicates if the test is to be ignored by execution
* Indicates if the test is to be disabled by execution
*/
ignore_flag integer(1),
disabled_flag integer(1),
--execution result fields
start_time timestamp with time zone,
end_time timestamp with time zone,
Expand Down
10 changes: 5 additions & 5 deletions source/core/types/ut_test.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ create or replace type body ut_test as

constructor function ut_test(
self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2, a_description varchar2 := null,
a_path varchar2 := null, a_rollback_type integer := null, a_ignore_flag boolean := false,
a_path varchar2 := null, a_rollback_type integer := null, a_disabled_flag boolean := false,
a_before_each_proc_name varchar2 := null, a_before_test_proc_name varchar2 := null,
a_after_test_proc_name varchar2 := null, a_after_each_proc_name varchar2 := null
) 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_ignore_flag);
self.init(a_object_owner, a_object_name, a_name, a_description, a_path, a_rollback_type, a_disabled_flag);
self.before_each := ut_executable(self, a_before_each_proc_name, ut_utils.gc_before_each);
self.before_test := ut_executable(self, a_before_test_proc_name, ut_utils.gc_before_test);
self.item := ut_executable(self, a_name, ut_utils.gc_test_execute);
Expand Down Expand Up @@ -55,9 +55,9 @@ create or replace type body ut_test as
a_listener.fire_before_event(ut_utils.gc_test,self);
self.start_time := current_timestamp;

if self.get_ignore_flag() then
self.result := ut_utils.tr_ignore;
ut_utils.debug_log('ut_test.execute - ignored');
if self.get_disabled_flag() then
self.result := ut_utils.tr_disabled;
ut_utils.debug_log('ut_test.execute - disabled');
self.results_count := ut_results_counter(self.result);
self.end_time := self.start_time;
else
Expand Down
2 changes: 1 addition & 1 deletion source/core/types/ut_test.tps
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ create or replace type ut_test under ut_suite_item (
parent_error_stack_trace varchar2(4000),
constructor function ut_test(
self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2, a_description varchar2 := null,
a_path varchar2 := null, a_rollback_type integer := null, a_ignore_flag boolean := false,
a_path varchar2 := null, a_rollback_type integer := null, a_disabled_flag boolean := false,
a_before_each_proc_name varchar2 := null, a_before_test_proc_name varchar2 := null,
a_after_test_proc_name varchar2 := null, a_after_each_proc_name varchar2 := null
) return self as result,
Expand Down
16 changes: 8 additions & 8 deletions source/core/ut_suite_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ create or replace package body ut_suite_manager is
a_path => l_suite_path, --a patch for this suite (excluding the package name of current suite)
a_description => l_suite_name,
a_rollback_type => l_suite_rollback,
a_ignore_flag => l_annotation_data.package_annotations.exists('disabled'),
a_disabled_flag => l_annotation_data.package_annotations.exists('disabled'),
a_before_all_proc_name => l_suite_setup_proc,
a_after_all_proc_name => l_suite_teardown_proc
);
Expand All @@ -138,17 +138,17 @@ create or replace package body ut_suite_manager is
if l_proc_annotations.exists('beforetest') then
l_beforetest_procedure := ut_annotations.get_annotation_param(l_proc_annotations('beforetest'), 1);
end if;

if l_proc_annotations.exists('aftertest') then
l_aftertest_procedure := ut_annotations.get_annotation_param(l_proc_annotations('aftertest'), 1);
end if;

if l_proc_annotations.exists('displayname') then
l_displayname := ut_annotations.get_annotation_param(l_proc_annotations('displayname'), 1);
elsif l_proc_annotations('test').count > 0 then
l_displayname := ut_annotations.get_annotation_param(l_proc_annotations('test'), 1);
end if;

if l_proc_annotations.exists('rollback') then
l_rollback_annotation := ut_annotations.get_annotation_param(l_proc_annotations('rollback'), 1);
l_rollback_type := case lower(l_rollback_annotation)
Expand All @@ -162,19 +162,19 @@ create or replace package body ut_suite_manager is
l_suite_rollback
end;
end if;

l_test := ut_test(a_object_owner => l_owner_name
,a_object_name => l_object_name
,a_name => l_proc_name
,a_description => l_displayname
,a_path => l_suite.path || '.' || l_proc_name
,a_rollback_type => l_rollback_type
,a_ignore_flag => l_proc_annotations.exists('disabled')
,a_disabled_flag => l_proc_annotations.exists('disabled')
,a_before_test_proc_name => l_beforetest_procedure
,a_after_test_proc_name => l_aftertest_procedure
,a_before_each_proc_name => l_default_setup_proc
,a_after_each_proc_name => l_default_teardown_proc);

l_suite.add_item(l_test);
end;
end if;
Expand Down Expand Up @@ -405,7 +405,7 @@ create or replace package body ut_suite_manager is
l_item_name varchar2(32767);

begin
a_suite.set_ignore_flag(false);
a_suite.set_disabled_flag(false);

if a_path is not null and a_suite is not null and a_suite is of (ut_logical_suite) then
l_suite := treat(a_suite as ut_logical_suite);
Expand Down
8 changes: 4 additions & 4 deletions source/core/ut_utils.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ create or replace package body ut_utils is
l_result := tr_failure_char;
elsif a_test_result = tr_error then
l_result := tr_error_char;
elsif a_test_result = tr_ignore then
l_result := tr_ignore_char;
elsif a_test_result = tr_disabled then
l_result := tr_disabled_char;
else
l_result := 'Unknown(' || coalesce(to_char(a_test_result),'NULL') || ')';
end if ;
Expand Down Expand Up @@ -288,7 +288,7 @@ create or replace package body ut_utils is
and o.object_type <> 'SYNONYM';
return l_result;
end;

procedure append_to_varchar2_list(a_list in out nocopy ut_varchar2_list, a_line varchar2) is
begin
if a_line is not null then
Expand All @@ -299,7 +299,7 @@ create or replace package body ut_utils is
a_list(a_list.last) := a_line;
end if;
end append_to_varchar2_list;

procedure append_to_clob(a_src_clob in out nocopy clob, a_new_data clob) is
begin
if a_new_data is not null and dbms_lob.getlength(a_new_data) > 0 then
Expand Down
8 changes: 4 additions & 4 deletions source/core/ut_utils.pks
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ create or replace package ut_utils authid definer is
gc_after_all constant varchar2(12) := 'after_all';

/* Constants: Test Results */
tr_ignore constant number(1) := 0; -- test/suite was ignored
tr_disabled constant number(1) := 0; -- test/suite was disabled
tr_success constant number(1) := 1; -- test passed
tr_failure constant number(1) := 2; -- one or more asserts failed
tr_error constant number(1) := 3; -- exception was raised

tr_ignore_char constant varchar2(6) := 'Ignore'; -- test/suite was ignored
tr_disabled_char constant varchar2(6) := 'Disabled'; -- test/suite was disabled
tr_success_char constant varchar2(7) := 'Success'; -- test passed
tr_failure_char constant varchar2(7) := 'Failure'; -- one or more asserts failed
tr_error_char constant varchar2(5) := 'Error'; -- exception was raised
Expand Down Expand Up @@ -198,12 +198,12 @@ create or replace package ut_utils authid definer is
* Returns a list of object that are part of utPLSQL framework
*/
function get_utplsql_objects_list return ut_object_names;

/*
* Append a line to the end of ut_varchar2_lst
*/
procedure append_to_varchar2_list(a_list in out nocopy ut_varchar2_list, a_line varchar2);

procedure append_to_clob(a_src_clob in out nocopy clob, a_new_data clob);
procedure append_to_clob(a_src_clob in out nocopy clob, a_new_data varchar2);

Expand Down
4 changes: 2 additions & 2 deletions source/reporters/ut_coverage_report_html_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ create or replace package body ut_coverage_report_html_helper is

gc_missed constant varchar2(7) := 'missed';
gc_skipped constant varchar2(7) := 'skipped';
gc_ignored constant varchar2(7) := 'never';
gc_disabled constant varchar2(7) := 'never';
gc_covered constant varchar2(7) := 'covered';


Expand Down Expand Up @@ -58,7 +58,7 @@ create or replace package body ut_coverage_report_html_helper is
case
when a_executions > 0 then gc_covered
when a_executions = 0 then gc_missed
else gc_ignored
else gc_disabled
end;
return l_result;
end;
Expand Down
4 changes: 2 additions & 2 deletions source/reporters/ut_documentation_reporter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ create or replace type body ut_documentation_reporter is
begin
l_message := coalesce(a_test.description, a_test.name);
--if test failed, then add it to the failures list, print failure with number
if a_test.result = ut_utils.tr_ignore then
if a_test.result = ut_utils.tr_disabled then
self.print_yellow_text(l_message || ' (IGNORED)');
elsif a_test.result = ut_utils.tr_success then
self.print_green_text(l_message);
Expand Down Expand Up @@ -180,7 +180,7 @@ create or replace type body ut_documentation_reporter is
l_summary_text :=
a_run.results_count.total_count || ' tests, '
|| a_run.results_count.failure_count || ' failed, ' || a_run.results_count.errored_count || ' errored, '
|| a_run.results_count.ignored_count ||' ignored, ' || a_run.results_count.warnings_count || ' warning(s)';
|| a_run.results_count.disabled_count ||' disabled, ' || a_run.results_count.warnings_count || ' warning(s)';
if a_run.results_count.failure_count + a_run.results_count.errored_count + a_run.results_count.warnings_count > 0 then
self.print_red_text(l_summary_text);
else
Expand Down
Loading