From 30586106dfc06bee8f6ce6e34ef3a9419e78f488 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Sun, 14 Apr 2019 12:22:49 +0100 Subject: [PATCH 01/23] Added tags for tests and tags for suite. --- source/api/ut.pkb | 88 ++++++++++++++------- source/api/ut.pks | 36 ++++++--- source/api/ut_runner.pkb | 16 +++- source/api/ut_runner.pks | 3 +- source/core/types/ut_run.tpb | 4 +- source/core/types/ut_run.tps | 4 +- source/core/types/ut_suite.tpb | 4 +- source/core/types/ut_suite.tps | 7 +- source/core/types/ut_test.tpb | 3 +- source/core/types/ut_test.tps | 8 +- source/core/ut_suite_builder.pkb | 66 +++++++++++++++- source/core/ut_suite_cache.sql | 5 +- source/core/ut_suite_cache_manager.pkb | 12 ++- source/core/ut_suite_manager.pkb | 88 +++++++++++++++------ source/core/ut_suite_manager.pks | 3 +- source/core/ut_utils.pkb | 14 ++++ source/core/ut_utils.pks | 4 +- test/ut3_tester/core/test_suite_builder.pkb | 7 ++ 18 files changed, 286 insertions(+), 86 deletions(-) diff --git a/source/api/ut.pkb b/source/api/ut.pkb index 5e13dcc62..96cf51102 100644 --- a/source/api/ut.pkb +++ b/source/api/ut.pkb @@ -120,7 +120,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list, a_client_character_set varchar2, a_random_test_order integer, - a_random_test_order_seed positive + a_random_test_order_seed positive, + a_tags ut_varchar2_rows := null ) is pragma autonomous_transaction; begin @@ -138,7 +139,8 @@ create or replace package body ut is a_client_character_set, false, ut_utils.int_to_boolean(a_random_test_order), - a_random_test_order_seed + a_random_test_order_seed, + a_tags ); rollback; end; @@ -154,7 +156,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list, a_client_character_set varchar2, a_random_test_order integer, - a_random_test_order_seed positive + a_random_test_order_seed positive, + a_tags ut_varchar2_rows := null ) is pragma autonomous_transaction; begin @@ -172,7 +175,8 @@ create or replace package body ut is a_client_character_set, false, ut_utils.int_to_boolean(a_random_test_order), - a_random_test_order_seed + a_random_test_order_seed, + a_tags ); rollback; end; @@ -212,7 +216,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := a_reporter; l_results sys_refcursor; @@ -228,7 +233,8 @@ create or replace package body ut is a_exclude_objects, a_client_character_set, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -249,7 +255,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := a_reporter; l_results sys_refcursor; @@ -265,7 +272,8 @@ create or replace package body ut is a_exclude_objects, a_client_character_set, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -287,7 +295,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := a_reporter; l_results sys_refcursor; @@ -303,7 +312,8 @@ create or replace package body ut is a_exclude_objects, a_client_character_set, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -325,7 +335,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := a_reporter; l_results sys_refcursor; @@ -341,7 +352,8 @@ create or replace package body ut is a_exclude_objects, a_client_character_set, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -363,7 +375,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := a_reporter; l_results sys_refcursor; @@ -379,7 +392,8 @@ create or replace package body ut is a_exclude_objects, a_client_character_set, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -401,7 +415,8 @@ create or replace package body ut is a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := a_reporter; l_results sys_refcursor; @@ -417,7 +432,8 @@ create or replace package body ut is a_exclude_objects, a_client_character_set, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -440,7 +456,8 @@ create or replace package body ut is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags ut_varchar2_rows := null ) is l_reporter ut_reporter_base := a_reporter; begin @@ -459,7 +476,8 @@ create or replace package body ut is a_client_character_set, a_force_manual_rollback, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + a_tags ); else run_autonomous( @@ -473,7 +491,8 @@ create or replace package body ut is a_exclude_objects, a_client_character_set, ut_utils.boolean_to_int(a_random_test_order), - a_random_test_order_seed + a_random_test_order_seed, + a_tags ); end if; if l_reporter is of (ut_output_reporter_base) then @@ -494,7 +513,8 @@ create or replace package body ut is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags ut_varchar2_rows := null ) is l_reporter ut_reporter_base := a_reporter; begin @@ -510,7 +530,8 @@ create or replace package body ut is a_client_character_set, a_force_manual_rollback, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + a_tags ); end; @@ -525,7 +546,8 @@ create or replace package body ut is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) is begin ut.run( @@ -540,7 +562,8 @@ create or replace package body ut is a_client_character_set, a_force_manual_rollback, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); end; @@ -555,7 +578,8 @@ create or replace package body ut is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) is begin ut.run( @@ -570,7 +594,8 @@ create or replace package body ut is a_client_character_set, a_force_manual_rollback, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); end; @@ -586,7 +611,8 @@ create or replace package body ut is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) is begin ut.run( @@ -601,7 +627,8 @@ create or replace package body ut is a_client_character_set, a_force_manual_rollback, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); end; @@ -617,7 +644,8 @@ create or replace package body ut is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) is begin ut.run( @@ -632,10 +660,12 @@ create or replace package body ut is a_client_character_set, a_force_manual_rollback, a_random_test_order, - a_random_test_order_seed + a_random_test_order_seed, + ut_varchar2_rows(a_tags) ); end; + procedure set_nls is begin if g_nls_date_format is null then diff --git a/source/api/ut.pks b/source/api/ut.pks index 7d3b191b3..e6065d85b 100644 --- a/source/api/ut.pks +++ b/source/api/ut.pks @@ -57,7 +57,8 @@ create or replace package ut authid current_user as a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined; function run( @@ -70,7 +71,8 @@ create or replace package ut authid current_user as a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined; function run( @@ -84,7 +86,8 @@ create or replace package ut authid current_user as a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined; function run( @@ -98,7 +101,8 @@ create or replace package ut authid current_user as a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined; function run( @@ -112,7 +116,8 @@ create or replace package ut authid current_user as a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined; function run( @@ -126,7 +131,8 @@ create or replace package ut authid current_user as a_exclude_objects ut_varchar2_list := null, a_client_character_set varchar2 := null, a_random_test_order integer := 0, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ) return ut_varchar2_rows pipelined; procedure run( @@ -140,7 +146,8 @@ create or replace package ut authid current_user as a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ); procedure run( @@ -154,7 +161,8 @@ create or replace package ut authid current_user as a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ); procedure run( @@ -169,7 +177,8 @@ create or replace package ut authid current_user as a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags ut_varchar2_rows := null ); procedure run( @@ -184,7 +193,8 @@ create or replace package ut authid current_user as a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags ut_varchar2_rows := null ); procedure run( @@ -199,7 +209,8 @@ create or replace package ut authid current_user as a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ); procedure run( @@ -214,7 +225,8 @@ create or replace package ut authid current_user as a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags varchar2 := null ); /** diff --git a/source/api/ut_runner.pkb b/source/api/ut_runner.pkb index 28ec1a610..3d262abe3 100644 --- a/source/api/ut_runner.pkb +++ b/source/api/ut_runner.pkb @@ -90,7 +90,8 @@ create or replace package body ut_runner is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags ut_varchar2_rows := null ) is l_run ut_run; l_coverage_schema_names ut_varchar2_rows; @@ -98,6 +99,7 @@ create or replace package body ut_runner is l_include_object_names ut_object_names; l_paths ut_varchar2_list := ut_varchar2_list(); l_random_test_order_seed positive; + l_tags ut_varchar2_rows := ut_varchar2_rows(); begin ut_event_manager.initialize(); if a_reporters is not empty then @@ -124,12 +126,17 @@ create or replace package body ut_runner is end loop; end if; + if (a_tags is not null) or not(a_tags is empty) then + for i in 1..a_tags.count loop + l_tags := l_tags multiset union ut_utils.convert_collection(ut_utils.string_to_table(a_string => a_tags(i),a_delimiter => ',')); + end loop; + end if; + begin ut_expectation_processor.reset_invalidation_exception(); ut_utils.save_dbms_output_to_cache(); ut_console_reporter_base.set_color_enabled(a_color_console); - if a_coverage_schemes is not empty then l_coverage_schema_names := ut_utils.convert_collection(a_coverage_schemes); else @@ -153,10 +160,11 @@ create or replace package body ut_runner is set(a_source_file_mappings), set(a_test_file_mappings), a_client_character_set, - l_random_test_order_seed + l_random_test_order_seed, + l_tags ); - ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed); + ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, l_tags); if a_force_manual_rollback then l_run.set_rollback_type( a_rollback_type => ut_utils.gc_rollback_manual, a_force => true ); end if; diff --git a/source/api/ut_runner.pks b/source/api/ut_runner.pks index ab2e1f6bb..895de3bb7 100644 --- a/source/api/ut_runner.pks +++ b/source/api/ut_runner.pks @@ -70,7 +70,8 @@ create or replace package ut_runner authid current_user is a_client_character_set varchar2 := null, a_force_manual_rollback boolean := false, a_random_test_order boolean := false, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_tags ut_varchar2_rows := null ); /** diff --git a/source/core/types/ut_run.tpb b/source/core/types/ut_run.tpb index d5ace34a7..c8f2778ff 100644 --- a/source/core/types/ut_run.tpb +++ b/source/core/types/ut_run.tpb @@ -26,10 +26,12 @@ create or replace type body ut_run as a_project_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_run_tags ut_varchar2_rows := null ) return self as result is begin self.run_paths := a_run_paths; + self.run_tags := a_run_tags; self.self_type := $$plsql_unit; self.items := a_items; self.client_character_set := lower(a_client_character_set); diff --git a/source/core/types/ut_run.tps b/source/core/types/ut_run.tps index 5d5e65367..b5a1d18ac 100644 --- a/source/core/types/ut_run.tps +++ b/source/core/types/ut_run.tps @@ -21,6 +21,7 @@ create or replace type ut_run under ut_suite_item ( project_name varchar2(4000), items ut_suite_items, run_paths ut_varchar2_list, + run_tags ut_varchar2_rows, coverage_options ut_coverage_options, test_file_mappings ut_file_mappings, client_character_set varchar2(100), @@ -35,7 +36,8 @@ create or replace type ut_run under ut_suite_item ( a_project_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, - a_random_test_order_seed positive := null + a_random_test_order_seed positive := null, + a_run_tags ut_varchar2_rows := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_run), overriding member function do_execute(self in out nocopy ut_run) return boolean, diff --git a/source/core/types/ut_suite.tpb b/source/core/types/ut_suite.tpb index 14a457623..bf683d8aa 100644 --- a/source/core/types/ut_suite.tpb +++ b/source/core/types/ut_suite.tpb @@ -17,7 +17,8 @@ create or replace type body ut_suite as */ constructor function ut_suite ( - self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer + self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, + a_suite_tags ut_varchar2_rows := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -25,6 +26,7 @@ create or replace type body ut_suite as self.items := ut_suite_items(); before_all_list := ut_executables(); after_all_list := ut_executables(); + self.suite_tags := a_suite_tags; return; end; diff --git a/source/core/types/ut_suite.tps b/source/core/types/ut_suite.tps index 7057e4911..0da911b4f 100644 --- a/source/core/types/ut_suite.tps +++ b/source/core/types/ut_suite.tps @@ -26,8 +26,13 @@ create or replace type ut_suite under ut_logical_suite ( * Procedure exists within the package of the suite */ after_all_list ut_executables, + /** + * Hold list of tags assign to suite + */ + suite_tags ut_varchar2_rows, constructor function ut_suite ( - self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer + self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, + a_suite_tags ut_varchar2_rows := null ) return self as result, overriding member function do_execute(self in out nocopy ut_suite) return boolean, overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list, diff --git a/source/core/types/ut_test.tpb b/source/core/types/ut_test.tpb index 14620b24b..f09a51162 100644 --- a/source/core/types/ut_test.tpb +++ b/source/core/types/ut_test.tpb @@ -18,7 +18,7 @@ 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_line_no integer, a_expected_error_codes ut_integer_list := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_test_tags ut_varchar2_rows := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -31,6 +31,7 @@ create or replace type body ut_test as self.all_expectations := ut_expectation_results(); self.failed_expectations := ut_expectation_results(); self.expected_error_codes := a_expected_error_codes; + self.test_tags := a_test_tags; return; end; diff --git a/source/core/types/ut_test.tps b/source/core/types/ut_test.tps index 752ef3ef7..caabdf1b1 100644 --- a/source/core/types/ut_test.tps +++ b/source/core/types/ut_test.tps @@ -1,4 +1,4 @@ -create or replace type ut_test under ut_suite_item ( +create or replace type ut_test force under ut_suite_item ( /* utPLSQL - Version 3 Copyright 2016 - 2018 utPLSQL Project @@ -55,9 +55,13 @@ create or replace type ut_test under ut_suite_item ( *Holds the expected error codes list when the user use the annotation throws */ expected_error_codes ut_integer_list, + /** + * Hold list of tags assign to test + */ + test_tags ut_varchar2_rows, constructor function ut_test( self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2, - a_line_no integer, a_expected_error_codes ut_integer_list := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_test_tags ut_varchar2_rows := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_test), overriding member function do_execute(self in out nocopy ut_test) return boolean, diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index b9e5b1b22..2a6a810e3 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -23,6 +23,7 @@ create or replace package body ut_suite_builder is gc_suite constant t_annotation_name := 'suite'; gc_suitepath constant t_annotation_name := 'suitepath'; + gc_tag constant t_annotation_name := 'tag'; gc_test constant t_annotation_name := ut_utils.gc_test_execute; gc_disabled constant t_annotation_name := 'disabled'; gc_displayname constant t_annotation_name := 'displayname'; @@ -43,6 +44,7 @@ create or replace package body ut_suite_builder is := tt_annotations( gc_suite, gc_suitepath, + gc_tag, gc_test, gc_disabled, gc_displayname, @@ -305,6 +307,33 @@ create or replace package body ut_suite_builder is end loop; end; + procedure add_tags_to_test( + a_suite in out nocopy ut_suite, + a_list in out nocopy ut_varchar2_rows, + a_procedure_name t_object_name, + a_tags_ann_text tt_annotation_texts + ) is + l_annotation_pos binary_integer; + begin + a_list := ut_varchar2_rows(); + l_annotation_pos := a_tags_ann_text.first; + while l_annotation_pos is not null loop + if a_tags_ann_text(l_annotation_pos) is null then + a_suite.put_warning( + '"--%tag" annotation requires a tag value populated. Annotation ignored.' + || chr( 10 ) || 'at "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || l_annotation_pos + ); + else + a_list := + a_list multiset union + ut_utils.convert_collection(ut_utils.trim_list_elements(ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos), ',', 'Y'))); + end if; + l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); + end loop; + + end; + + procedure set_seq_no( a_list in out nocopy ut_executables ) is @@ -483,13 +512,19 @@ create or replace package body ut_suite_builder is ); set_seq_no(l_test.after_test_list); end if; + + if l_proc_annotations.exists( gc_tag) then + add_tags_to_test(a_suite, l_test.test_tags, a_procedure_name, l_proc_annotations( gc_tag)); + end if; + if l_proc_annotations.exists( gc_throws) then add_to_throws_numbers_list(a_suite, l_test.expected_error_codes, a_procedure_name, l_proc_annotations( gc_throws)); end if; l_test.disabled_flag := ut_utils.boolean_to_int( l_proc_annotations.exists( gc_disabled)); - + a_suite_items.extend; a_suite_items( a_suite_items.last ) := l_test; + end; procedure propagate_before_after_each( @@ -583,6 +618,29 @@ create or replace package body ut_suite_builder is a_suite.path := lower(coalesce(a_suite.path, a_suite.object_name)); end; + procedure add_tags_to_suite( + a_suite in out nocopy ut_suite, + a_tags_ann_text tt_annotation_texts + ) is + l_annotation_pos binary_integer; + l_tags ut_varchar2_rows := ut_varchar2_rows(); + begin + l_annotation_pos := a_tags_ann_text.first; + while l_annotation_pos is not null loop + if a_tags_ann_text(l_annotation_pos) is null then + a_suite.put_warning( + '"--%tag" annotation requires a tag value populated. Annotation ignored, line ' || l_annotation_pos + ); + else + l_tags := + l_tags multiset union + ut_utils.convert_collection(ut_utils.trim_list_elements(ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos), ',', 'Y'))); + end if; + l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); + end loop; + a_suite.suite_tags := l_tags; + end; + procedure add_suite_tests( a_suite in out nocopy ut_suite, a_annotations t_annotations_info, @@ -594,6 +652,7 @@ create or replace package body ut_suite_builder is l_after_all_list tt_executables; l_rollback_type ut_utils.t_rollback_type; l_annotation_text t_annotation_text; + l_suite_tags ut_varchar2_rows; begin if a_annotations.by_name.exists(gc_displayname) then l_annotation_text := trim(a_annotations.by_name(gc_displayname)(a_annotations.by_name(gc_displayname).first)); @@ -631,7 +690,10 @@ create or replace package body ut_suite_builder is if a_annotations.by_name.exists(gc_aftereach) then l_after_each_list := add_executables( a_suite.object_owner, a_suite.object_name, a_annotations.by_name(gc_aftereach), gc_aftereach ); end if; - + + if a_annotations.by_name.exists(gc_tag) then + add_tags_to_suite(a_suite, a_annotations.by_name(gc_tag)); + end if; a_suite.disabled_flag := ut_utils.boolean_to_int(a_annotations.by_name.exists(gc_disabled)); --process procedure annotations for suite diff --git a/source/core/ut_suite_cache.sql b/source/core/ut_suite_cache.sql index adbdf1734..e41af9607 100644 --- a/source/core/ut_suite_cache.sql +++ b/source/core/ut_suite_cache.sql @@ -36,6 +36,7 @@ create table ut_suite_cache ( after_each_list, after_test_list, expected_error_codes, + tags, item ) nested table warnings store as ut_suite_cache_warnings @@ -45,7 +46,8 @@ create table ut_suite_cache ( nested table after_each_list store as ut_suite_cache_after_each nested table before_test_list store as ut_suite_cache_before_test nested table after_test_list store as ut_suite_cache_after_test - nested table expected_error_codes store as ut_suite_cache_trhows + nested table expected_error_codes store as ut_suite_cache_throws + nested table tags store as ut_suite_cache_tags return as locator as select cast(null as number(22)) id, @@ -67,6 +69,7 @@ create table ut_suite_cache ( t.after_each_list, t.after_test_list, t.expected_error_codes, + t.test_tags, t.item from table(ut_suite_contexts(ut_suite_context(user,'package_name','ctx_name',1))) c cross join table(ut_tests(ut_test(user,'package_name','test_name',1))) t diff --git a/source/core/ut_suite_cache_manager.pkb b/source/core/ut_suite_cache_manager.pkb index ce7f018e0..55a6816e0 100644 --- a/source/core/ut_suite_cache_manager.pkb +++ b/source/core/ut_suite_cache_manager.pkb @@ -90,7 +90,8 @@ create or replace package body ut_suite_cache_manager is before_all_list, after_all_list, before_each_list, after_each_list, before_test_list, after_test_list, - expected_error_codes, item + expected_error_codes, tags, + item ) with suites as ( select treat(value(x) as ut_suite) i @@ -103,7 +104,8 @@ create or replace package body ut_suite_cache_manager is s.i.before_all_list as before_all_list, s.i.after_all_list as after_all_list, null before_each_list, null after_each_list, null before_test_list, null after_test_list, - null expected_error_codes, null item + null expected_error_codes, s.i.suite_tags tags, + null item from suites s; insert into ut_suite_cache t @@ -114,7 +116,8 @@ create or replace package body ut_suite_cache_manager is before_all_list, after_all_list, before_each_list, after_each_list, before_test_list, after_test_list, - expected_error_codes, item + expected_error_codes, tags, + item ) with tests as ( select treat(value(x) as ut_test) t @@ -127,7 +130,8 @@ create or replace package body ut_suite_cache_manager is null before_all_list, null after_all_list, s.t.before_each_list as before_each_list, s.t.after_each_list as after_each_list, s.t.before_test_list as before_test_list, s.t.after_test_list as after_test_list, - s.t.expected_error_codes as expected_error_codes, s.t.item as item + s.t.expected_error_codes as expected_error_codes, s.t.test_tags as test_tags, + s.t.item as item from tests s; end if; diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 51d3fa1e4..ad433b8da 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -57,7 +57,7 @@ create or replace package body ut_suite_manager is end loop; return l_paths_temp; end; - + function resolve_schema_names(a_paths in out nocopy ut_varchar2_list) return ut_varchar2_rows is l_schema varchar2(4000); l_object varchar2(4000); @@ -100,6 +100,7 @@ create or replace package body ut_suite_manager is l_schema_names.extend; l_schema_names(l_schema_names.last) := l_schema; end loop; + return l_schema_names; end; @@ -192,7 +193,7 @@ create or replace package body ut_suite_manager is 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) + a_rows( a_idx ).after_all_list), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate ) else ut_suite( @@ -205,7 +206,7 @@ create or replace package body ut_suite_manager is 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) + a_rows( a_idx ).after_all_list), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate ) end; when 'UT_SUITE_CONTEXT' then @@ -221,7 +222,7 @@ create or replace package body ut_suite_manager is 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) + a_rows( a_idx ).after_all_list), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate ) else ut_suite_context( @@ -234,7 +235,7 @@ create or replace package body ut_suite_manager is 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) + a_rows( a_idx ).after_all_list), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate ) end; when 'UT_LOGICAL_SUITE' then @@ -276,7 +277,8 @@ create or replace package body ut_suite_manager is 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 + parent_error_stack_trace => null, expected_error_codes => a_rows(a_idx).expected_error_codes, + test_tags => a_rows(a_idx).tags ); end case; l_result.results_count.warnings_count := l_result.warnings.count; @@ -360,13 +362,17 @@ create or replace package body ut_suite_manager is a_object_name varchar2 := null, a_procedure_name varchar2 := null, a_skip_all_objects boolean := false, - a_random_seed positive + a_random_seed positive, + a_tags ut_varchar2_rows := null ) return t_cached_suites_cursor is l_path varchar2( 4000 ); l_result sys_refcursor; l_ut_owner varchar2(250) := ut_utils.ut_owner; + l_sql varchar2(32767); + l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows()); + l_suite_item_name varchar2(20); begin - if a_path is null and a_object_name is not null then + if a_path is null and a_object_name is not null then execute immediate 'select min(path) from '||l_ut_owner||q'[.ut_suite_cache where object_owner = :a_object_owner @@ -376,12 +382,15 @@ create or replace package body ut_suite_manager is else l_path := lower( a_path ); end if; - - open l_result for + + l_suite_item_name := case when l_tags.count > 0 then 'suite_items_tags' else 'suite_items' end; + + /* Rewrite that as tags should be put on whats left not on full suite item cache */ + l_sql := q'[with suite_items as ( - select /*+ cardinality(c 100) */ c.* - from ]'||l_ut_owner||q'[.ut_suite_cache 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 ( select 1 @@ -405,12 +414,30 @@ create or replace package body ut_suite_manager is else 'and :a_procedure_name is null' end ||q'[ ) ) - ), - suitepaths as ( + ),]' + ||case when l_tags.count > 0 then + q'[ filter_tags as ( + select s.* from suite_items s + where exists + ( select 1 + from table(s.tags) ct,table(:l_tags) tag + where ct.column_value = tag.column_value) + ), + suite_items_tags as ( + select c.* from suite_items c + where exists (select 1 from filter_tags t where + t.path||'.' like c.path || '.%' /*all children and self*/ + or c.path||'.' like t.path || '.%' --all parents + ) + ),]' + else + q'[dummy as (select 1 from table(:l_tags) where 1 = 2 ),]' + end|| + q'[ suitepaths as ( select distinct substr(path,1,instr(path,'.',-1)-1) as suitepath, path, object_owner - from suite_items + from ]'||l_suite_item_name||q'[ where self_type = 'UT_SUITE' ), gen as ( @@ -430,6 +457,7 @@ create or replace package body ut_suite_manager is upper( substr(p.path, instr( p.path, '.', -1 ) + 1 ) ) as object_name, cast(null as ]'||l_ut_owner||q'[.ut_executables) as x, cast(null as ]'||l_ut_owner||q'[.ut_integer_list) as y, + cast(null as ]'||l_ut_owner||q'[.ut_varchar2_rows) as q, cast(null as ]'||l_ut_owner||q'[.ut_executable_test) as z from suitepath_part p where p.path @@ -443,11 +471,12 @@ create or replace package body ut_suite_manager is s.x as before_all_list, s.x as after_all_list, s.x as before_each_list, s.x as before_test_list, s.x as after_each_list, s.x as after_test_list, - s.y as expected_error_codes, s.z as item + s.y as expected_error_codes, s.q as test_tags, + s.z as item from logical_suite_data s ), items as ( - select * from suite_items + select * from ]'||l_suite_item_name||q'[ union all select * from logical_suites ) @@ -470,8 +499,8 @@ create or replace package body ut_suite_manager is l_ut_owner||'.ut_annotation_manager.hash_suite_path( c.path, :a_random_seed ) desc nulls last' - end - using l_path, l_path, upper(a_object_name), upper(a_procedure_name), a_random_seed; + end; + open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tags, a_random_seed; return l_result; end; @@ -558,7 +587,8 @@ create or replace package body ut_suite_manager is a_object_name varchar2 := null, a_procedure_name varchar2 := null, a_suites in out nocopy ut_suite_items, - a_random_seed positive + a_random_seed positive, + a_tags ut_varchar2_rows := null ) is begin refresh_cache(a_owner_name); @@ -571,7 +601,8 @@ create or replace package body ut_suite_manager is a_object_name, a_procedure_name, can_skip_all_objects_scan(a_owner_name), - a_random_seed + a_random_seed, + a_tags ) ); @@ -601,6 +632,7 @@ create or replace package body ut_suite_manager is a_object_name, a_procedure_name, a_skip_all_objects, + null, null ) ); @@ -662,7 +694,8 @@ create or replace package body ut_suite_manager is procedure configure_execution_by_path( a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, - a_random_seed in positive := null + a_random_seed in positive := null, + a_tags ut_varchar2_rows := null ) is l_paths ut_varchar2_list := a_paths; l_path_items t_path_items; @@ -677,7 +710,11 @@ create or replace package body ut_suite_manager is resolve_schema_names(l_paths); l_schema_paths := group_paths_by_schema(l_paths); - + + -- TODO : use a_tags to filter out path. Should we do it before ? we dont know suites, if we do it after + -- we running into danger of filtering out to null value and raising wrong message. I reckon we should resolve that + -- before loop and l_th_items is set or after filter it out. + l_schema := l_schema_paths.first; while l_schema is not null loop l_path_items := l_schema_paths(l_schema); @@ -689,7 +726,8 @@ create or replace package body ut_suite_manager is l_path_item.object_name, l_path_item.procedure_name, a_suites, - a_random_seed + a_random_seed, + a_tags ); if a_suites.count = l_suites_count then if l_path_item.suite_path is not null then @@ -698,6 +736,8 @@ create or replace package body ut_suite_manager is raise_application_error(ut_utils.gc_suite_package_not_found,'Suite test '||l_schema||'.'||l_path_item.object_name|| '.'||l_path_item.procedure_name||' does not exist'); elsif l_path_item.object_name is not null then raise_application_error(ut_utils.gc_suite_package_not_found,'Suite package '||l_schema||'.'||l_path_item.object_name|| ' does not exist'); + elsif a_tags.count > 0 then + raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for tags: '||ut_utils.to_string(ut_utils.table_to_clob(a_tags,','),a_max_output_len => 450)); end if; end if; l_index := a_suites.first; diff --git a/source/core/ut_suite_manager.pks b/source/core/ut_suite_manager.pks index debfd4ac1..9b214a6c2 100644 --- a/source/core/ut_suite_manager.pks +++ b/source/core/ut_suite_manager.pks @@ -49,7 +49,8 @@ create or replace package ut_suite_manager authid current_user is procedure configure_execution_by_path( a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, - a_random_seed in positive := null + a_random_seed in positive := null, + a_tags ut_varchar2_rows := null ); /** diff --git a/source/core/ut_utils.pkb b/source/core/ut_utils.pkb index 25ef3fb3f..be8da247e 100644 --- a/source/core/ut_utils.pkb +++ b/source/core/ut_utils.pkb @@ -278,6 +278,20 @@ create or replace package body ut_utils is return l_result; end; + function table_to_clob(a_text_table ut_varchar2_rows, a_delimiter varchar2:= chr(10)) return clob is + l_result clob; + l_table_rows integer := coalesce(cardinality(a_text_table),0); + begin + for i in 1 .. l_table_rows loop + if i < l_table_rows then + append_to_clob(l_result, a_text_table(i)||a_delimiter); + else + append_to_clob(l_result, a_text_table(i)); + end if; + end loop; + return l_result; + end; + function table_to_clob(a_integer_table ut_integer_list, a_delimiter varchar2:= chr(10)) return clob is l_result clob; l_table_rows integer := coalesce(cardinality(a_integer_table),0); diff --git a/source/core/ut_utils.pks b/source/core/ut_utils.pks index ebb9780ad..6832e0ceb 100644 --- a/source/core/ut_utils.pks +++ b/source/core/ut_utils.pks @@ -234,7 +234,9 @@ create or replace package ut_utils authid definer is function clob_to_table(a_clob clob, a_max_amount integer := 8191, a_delimiter varchar2:= chr(10)) return ut_varchar2_list; function table_to_clob(a_text_table ut_varchar2_list, a_delimiter varchar2:= chr(10)) return clob; - + + function table_to_clob(a_text_table ut_varchar2_rows, a_delimiter varchar2:= chr(10)) return clob; + function table_to_clob(a_integer_table ut_integer_list, a_delimiter varchar2:= chr(10)) return clob; /** diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index e6d21d969..7ef85a53a 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -652,6 +652,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || + '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -661,6 +662,7 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || + '' || '' ); end; @@ -796,6 +798,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || + ''|| '' ); end; @@ -837,6 +840,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || + '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -846,6 +850,7 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || + '' || '' ); end; @@ -892,6 +897,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || + '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -901,6 +907,7 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || + '' || '' ); end; From 3495490a1567ed8013c95ff550d27204a3dac5e4 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Fri, 19 Apr 2019 21:04:55 +0100 Subject: [PATCH 02/23] Switch to use VARCHAR2 instead of UT_VARCHAR2_ROWS() Signed-off-by: lwasylow --- source/api/ut.pkb | 28 ++++++------- source/api/ut.pks | 4 +- source/api/ut_runner.pkb | 13 ++---- source/api/ut_runner.pks | 2 +- source/core/types/ut_run.tpb | 2 +- source/core/types/ut_run.tps | 4 +- source/core/types/ut_suite.tpb | 4 +- source/core/types/ut_suite.tps | 4 +- source/core/types/ut_test.tpb | 4 +- source/core/types/ut_test.tps | 4 +- source/core/ut_suite_builder.pkb | 15 +++---- source/core/ut_suite_cache.sql | 3 +- source/core/ut_suite_cache_manager.pkb | 17 +++++++- source/core/ut_suite_cache_tag.sql | 7 ++++ source/core/ut_suite_manager.pkb | 40 +++++++++---------- source/core/ut_suite_manager.pks | 2 +- .../create_synonyms_and_grants_for_public.sql | 1 + source/create_user_grants.sql | 1 + source/install.sql | 1 + source/uninstall_objects.sql | 2 + test/ut3_tester/core/test_suite_builder.pkb | 4 +- 21 files changed, 87 insertions(+), 75 deletions(-) create mode 100644 source/core/ut_suite_cache_tag.sql diff --git a/source/api/ut.pkb b/source/api/ut.pkb index 96cf51102..1a95f0725 100644 --- a/source/api/ut.pkb +++ b/source/api/ut.pkb @@ -121,7 +121,7 @@ create or replace package body ut is a_client_character_set varchar2, a_random_test_order integer, a_random_test_order_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is pragma autonomous_transaction; begin @@ -157,7 +157,7 @@ create or replace package body ut is a_client_character_set varchar2, a_random_test_order integer, a_random_test_order_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is pragma autonomous_transaction; begin @@ -234,7 +234,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -273,7 +273,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -313,7 +313,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -353,7 +353,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -393,7 +393,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -433,7 +433,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -457,7 +457,7 @@ create or replace package body ut is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_reporter ut_reporter_base := a_reporter; begin @@ -514,7 +514,7 @@ create or replace package body ut is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_reporter ut_reporter_base := a_reporter; begin @@ -563,7 +563,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; @@ -595,7 +595,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; @@ -628,7 +628,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; @@ -661,7 +661,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; diff --git a/source/api/ut.pks b/source/api/ut.pks index e6065d85b..17b4a845e 100644 --- a/source/api/ut.pks +++ b/source/api/ut.pks @@ -178,7 +178,7 @@ create or replace package ut authid current_user as a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); procedure run( @@ -194,7 +194,7 @@ create or replace package ut authid current_user as a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); procedure run( diff --git a/source/api/ut_runner.pkb b/source/api/ut_runner.pkb index 3d262abe3..30cdf2691 100644 --- a/source/api/ut_runner.pkb +++ b/source/api/ut_runner.pkb @@ -91,7 +91,7 @@ create or replace package body ut_runner is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_run ut_run; l_coverage_schema_names ut_varchar2_rows; @@ -99,7 +99,6 @@ create or replace package body ut_runner is l_include_object_names ut_object_names; l_paths ut_varchar2_list := ut_varchar2_list(); l_random_test_order_seed positive; - l_tags ut_varchar2_rows := ut_varchar2_rows(); begin ut_event_manager.initialize(); if a_reporters is not empty then @@ -126,12 +125,6 @@ create or replace package body ut_runner is end loop; end if; - if (a_tags is not null) or not(a_tags is empty) then - for i in 1..a_tags.count loop - l_tags := l_tags multiset union ut_utils.convert_collection(ut_utils.string_to_table(a_string => a_tags(i),a_delimiter => ',')); - end loop; - end if; - begin ut_expectation_processor.reset_invalidation_exception(); ut_utils.save_dbms_output_to_cache(); @@ -161,10 +154,10 @@ create or replace package body ut_runner is set(a_test_file_mappings), a_client_character_set, l_random_test_order_seed, - l_tags + a_tags ); - ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, l_tags); + ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, a_tags); if a_force_manual_rollback then l_run.set_rollback_type( a_rollback_type => ut_utils.gc_rollback_manual, a_force => true ); end if; diff --git a/source/api/ut_runner.pks b/source/api/ut_runner.pks index 895de3bb7..0434790f5 100644 --- a/source/api/ut_runner.pks +++ b/source/api/ut_runner.pks @@ -71,7 +71,7 @@ create or replace package ut_runner authid current_user is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); /** diff --git a/source/core/types/ut_run.tpb b/source/core/types/ut_run.tpb index c8f2778ff..d26c6fcb4 100644 --- a/source/core/types/ut_run.tpb +++ b/source/core/types/ut_run.tpb @@ -27,7 +27,7 @@ create or replace type body ut_run as a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, a_random_test_order_seed positive := null, - a_run_tags ut_varchar2_rows := null + a_run_tags varchar2 := null ) return self as result is begin self.run_paths := a_run_paths; diff --git a/source/core/types/ut_run.tps b/source/core/types/ut_run.tps index b5a1d18ac..7ea5cc605 100644 --- a/source/core/types/ut_run.tps +++ b/source/core/types/ut_run.tps @@ -21,7 +21,7 @@ create or replace type ut_run under ut_suite_item ( project_name varchar2(4000), items ut_suite_items, run_paths ut_varchar2_list, - run_tags ut_varchar2_rows, + run_tags varchar2(4000), coverage_options ut_coverage_options, test_file_mappings ut_file_mappings, client_character_set varchar2(100), @@ -37,7 +37,7 @@ create or replace type ut_run under ut_suite_item ( a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, a_random_test_order_seed positive := null, - a_run_tags ut_varchar2_rows := null + a_run_tags varchar2 := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_run), overriding member function do_execute(self in out nocopy ut_run) return boolean, diff --git a/source/core/types/ut_suite.tpb b/source/core/types/ut_suite.tpb index bf683d8aa..bd35d18ca 100644 --- a/source/core/types/ut_suite.tpb +++ b/source/core/types/ut_suite.tpb @@ -18,7 +18,7 @@ create or replace type body ut_suite as constructor function ut_suite ( self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, - a_suite_tags ut_varchar2_rows := null + a_tags varchar2 := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -26,7 +26,7 @@ create or replace type body ut_suite as self.items := ut_suite_items(); before_all_list := ut_executables(); after_all_list := ut_executables(); - self.suite_tags := a_suite_tags; + self.tags := a_tags; return; end; diff --git a/source/core/types/ut_suite.tps b/source/core/types/ut_suite.tps index 0da911b4f..0bcddd59b 100644 --- a/source/core/types/ut_suite.tps +++ b/source/core/types/ut_suite.tps @@ -29,10 +29,10 @@ create or replace type ut_suite under ut_logical_suite ( /** * Hold list of tags assign to suite */ - suite_tags ut_varchar2_rows, + tags varchar2(4000), constructor function ut_suite ( self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, - a_suite_tags ut_varchar2_rows := null + a_tags varchar2 := null ) return self as result, overriding member function do_execute(self in out nocopy ut_suite) return boolean, overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list, diff --git a/source/core/types/ut_test.tpb b/source/core/types/ut_test.tpb index f09a51162..c1d847bf5 100644 --- a/source/core/types/ut_test.tpb +++ b/source/core/types/ut_test.tpb @@ -18,7 +18,7 @@ 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_line_no integer, a_expected_error_codes ut_integer_list := null, a_test_tags ut_varchar2_rows := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags varchar2 := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -31,7 +31,7 @@ create or replace type body ut_test as self.all_expectations := ut_expectation_results(); self.failed_expectations := ut_expectation_results(); self.expected_error_codes := a_expected_error_codes; - self.test_tags := a_test_tags; + self.tags := a_tags; return; end; diff --git a/source/core/types/ut_test.tps b/source/core/types/ut_test.tps index caabdf1b1..23116119c 100644 --- a/source/core/types/ut_test.tps +++ b/source/core/types/ut_test.tps @@ -58,10 +58,10 @@ create or replace type ut_test force under ut_suite_item ( /** * Hold list of tags assign to test */ - test_tags ut_varchar2_rows, + tags 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_line_no integer, a_expected_error_codes ut_integer_list := null, a_test_tags ut_varchar2_rows := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags varchar2 := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_test), overriding member function do_execute(self in out nocopy ut_test) return boolean, diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index 2a6a810e3..e11c91a2b 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -309,13 +309,12 @@ create or replace package body ut_suite_builder is procedure add_tags_to_test( a_suite in out nocopy ut_suite, - a_list in out nocopy ut_varchar2_rows, + a_list in out nocopy varchar2, a_procedure_name t_object_name, a_tags_ann_text tt_annotation_texts ) is l_annotation_pos binary_integer; begin - a_list := ut_varchar2_rows(); l_annotation_pos := a_tags_ann_text.first; while l_annotation_pos is not null loop if a_tags_ann_text(l_annotation_pos) is null then @@ -325,8 +324,7 @@ create or replace package body ut_suite_builder is ); else a_list := - a_list multiset union - ut_utils.convert_collection(ut_utils.trim_list_elements(ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos), ',', 'Y'))); + a_list || a_tags_ann_text(l_annotation_pos); end if; l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; @@ -514,7 +512,7 @@ create or replace package body ut_suite_builder is end if; if l_proc_annotations.exists( gc_tag) then - add_tags_to_test(a_suite, l_test.test_tags, a_procedure_name, l_proc_annotations( gc_tag)); + add_tags_to_test(a_suite, l_test.tags, a_procedure_name, l_proc_annotations( gc_tag)); end if; if l_proc_annotations.exists( gc_throws) then @@ -623,7 +621,7 @@ create or replace package body ut_suite_builder is a_tags_ann_text tt_annotation_texts ) is l_annotation_pos binary_integer; - l_tags ut_varchar2_rows := ut_varchar2_rows(); + l_tags varchar2(4000); begin l_annotation_pos := a_tags_ann_text.first; while l_annotation_pos is not null loop @@ -633,12 +631,11 @@ create or replace package body ut_suite_builder is ); else l_tags := - l_tags multiset union - ut_utils.convert_collection(ut_utils.trim_list_elements(ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos), ',', 'Y'))); + l_tags || a_tags_ann_text(l_annotation_pos); end if; l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; - a_suite.suite_tags := l_tags; + a_suite.tags := l_tags; end; procedure add_suite_tests( diff --git a/source/core/ut_suite_cache.sql b/source/core/ut_suite_cache.sql index e41af9607..3a38ceeb7 100644 --- a/source/core/ut_suite_cache.sql +++ b/source/core/ut_suite_cache.sql @@ -47,7 +47,6 @@ create table ut_suite_cache ( nested table before_test_list store as ut_suite_cache_before_test nested table after_test_list store as ut_suite_cache_after_test nested table expected_error_codes store as ut_suite_cache_throws - nested table tags store as ut_suite_cache_tags return as locator as select cast(null as number(22)) id, @@ -69,7 +68,7 @@ create table ut_suite_cache ( t.after_each_list, t.after_test_list, t.expected_error_codes, - t.test_tags, + t.tags, t.item from table(ut_suite_contexts(ut_suite_context(user,'package_name','ctx_name',1))) c cross join table(ut_tests(ut_test(user,'package_name','test_name',1))) t diff --git a/source/core/ut_suite_cache_manager.pkb b/source/core/ut_suite_cache_manager.pkb index 55a6816e0..526a03338 100644 --- a/source/core/ut_suite_cache_manager.pkb +++ b/source/core/ut_suite_cache_manager.pkb @@ -104,7 +104,7 @@ create or replace package body ut_suite_cache_manager is s.i.before_all_list as before_all_list, s.i.after_all_list as after_all_list, null before_each_list, null after_each_list, null before_test_list, null after_test_list, - null expected_error_codes, s.i.suite_tags tags, + null expected_error_codes, s.i.tags tags, null item from suites s; @@ -130,9 +130,22 @@ create or replace package body ut_suite_cache_manager is null before_all_list, null after_all_list, s.t.before_each_list as before_each_list, s.t.after_each_list as after_each_list, s.t.before_test_list as before_test_list, s.t.after_test_list as after_test_list, - s.t.expected_error_codes as expected_error_codes, s.t.test_tags as test_tags, + s.t.expected_error_codes as expected_error_codes, s.t.tags as test_tags, s.t.item as item from tests s; + + --TODO : Optimize to use only inserted + merge into ut_suite_cache_tag tgt + using ( select /*+cardinality (tt 100) */ t.id,tt.column_value tag + from ut_suite_cache t, + table(ut_utils.convert_collection((ut_utils.string_to_table(t.tags,',')))) tt + where tt.column_value is not null ) src + on ( tgt.suiteid = src.id and tgt.tagname = src.tag) + when not matched then + insert + (suiteid, tagname ) + values + (src.id, src.tag); end if; end if; diff --git a/source/core/ut_suite_cache_tag.sql b/source/core/ut_suite_cache_tag.sql new file mode 100644 index 000000000..17d287dd8 --- /dev/null +++ b/source/core/ut_suite_cache_tag.sql @@ -0,0 +1,7 @@ +create table ut_suite_cache_tag ( + suiteid number(22) not null, + tagname varchar2(100) not null, + constraint ut_suite_to_tag_pk primary key (suiteid,tagname), + constraint ut_suite_id_fk foreign key ( suiteid ) references ut_suite_cache(id) on delete cascade +) +organization index; \ No newline at end of file diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index ad433b8da..54bf8fa04 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -193,7 +193,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) else ut_suite( @@ -206,7 +206,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) end; when 'UT_SUITE_CONTEXT' then @@ -222,7 +222,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) else ut_suite_context( @@ -235,7 +235,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) end; when 'UT_LOGICAL_SUITE' then @@ -278,7 +278,7 @@ create or replace package body ut_suite_manager is 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, - test_tags => a_rows(a_idx).tags + tags => a_rows(a_idx).tags ); end case; l_result.results_count.warnings_count := l_result.warnings.count; @@ -363,14 +363,14 @@ create or replace package body ut_suite_manager is a_procedure_name varchar2 := null, a_skip_all_objects boolean := false, a_random_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) return t_cached_suites_cursor is l_path varchar2( 4000 ); l_result sys_refcursor; l_ut_owner varchar2(250) := ut_utils.ut_owner; l_sql varchar2(32767); - l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows()); l_suite_item_name varchar2(20); + l_tag_list varchar2(4000) :=a_tags; begin if a_path is null and a_object_name is not null then execute immediate 'select min(path) @@ -382,8 +382,7 @@ create or replace package body ut_suite_manager is else l_path := lower( a_path ); end if; - - l_suite_item_name := case when l_tags.count > 0 then 'suite_items_tags' else 'suite_items' end; + l_suite_item_name := case when l_tag_list is not null then 'suite_items_tags' else 'suite_items' end; /* Rewrite that as tags should be put on whats left not on full suite item cache */ l_sql := @@ -415,13 +414,13 @@ create or replace package body ut_suite_manager is ) ) ),]' - ||case when l_tags.count > 0 then + ||case when l_tag_list is not null then q'[ filter_tags as ( select s.* from suite_items s where exists ( select 1 - from table(s.tags) ct,table(:l_tags) tag - where ct.column_value = tag.column_value) + from ]'||l_ut_owner||q'[.ut_suite_cache_tag ct + where ct.suiteid = s.id and instr(:a_tag_list,ct.tagname) > 0 ) ), suite_items_tags as ( select c.* from suite_items c @@ -431,7 +430,7 @@ create or replace package body ut_suite_manager is ) ),]' else - q'[dummy as (select 1 from table(:l_tags) where 1 = 2 ),]' + q'[dummy as (select 'x' from dual where :a_tag_list is null ),]' end|| q'[ suitepaths as ( select distinct substr(path,1,instr(path,'.',-1)-1) as suitepath, @@ -457,7 +456,6 @@ create or replace package body ut_suite_manager is upper( substr(p.path, instr( p.path, '.', -1 ) + 1 ) ) as object_name, cast(null as ]'||l_ut_owner||q'[.ut_executables) as x, cast(null as ]'||l_ut_owner||q'[.ut_integer_list) as y, - cast(null as ]'||l_ut_owner||q'[.ut_varchar2_rows) as q, cast(null as ]'||l_ut_owner||q'[.ut_executable_test) as z from suitepath_part p where p.path @@ -471,7 +469,7 @@ create or replace package body ut_suite_manager is s.x as before_all_list, s.x as after_all_list, s.x as before_each_list, s.x as before_test_list, s.x as after_each_list, s.x as after_test_list, - s.y as expected_error_codes, s.q as test_tags, + s.y as expected_error_codes, null as test_tags, s.z as item from logical_suite_data s ), @@ -499,8 +497,8 @@ create or replace package body ut_suite_manager is l_ut_owner||'.ut_annotation_manager.hash_suite_path( c.path, :a_random_seed ) desc nulls last' - end; - open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tags, a_random_seed; + end; + open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tag_list, a_random_seed; return l_result; end; @@ -588,7 +586,7 @@ create or replace package body ut_suite_manager is a_procedure_name varchar2 := null, a_suites in out nocopy ut_suite_items, a_random_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is begin refresh_cache(a_owner_name); @@ -695,7 +693,7 @@ create or replace package body ut_suite_manager is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_paths ut_varchar2_list := a_paths; l_path_items t_path_items; @@ -736,8 +734,8 @@ create or replace package body ut_suite_manager is raise_application_error(ut_utils.gc_suite_package_not_found,'Suite test '||l_schema||'.'||l_path_item.object_name|| '.'||l_path_item.procedure_name||' does not exist'); elsif l_path_item.object_name is not null then raise_application_error(ut_utils.gc_suite_package_not_found,'Suite package '||l_schema||'.'||l_path_item.object_name|| ' does not exist'); - elsif a_tags.count > 0 then - raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for tags: '||ut_utils.to_string(ut_utils.table_to_clob(a_tags,','),a_max_output_len => 450)); + elsif a_tags is not null then + raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for tags: '||ut_utils.to_string(a_tags,a_max_output_len => 450)); end if; end if; l_index := a_suites.first; diff --git a/source/core/ut_suite_manager.pks b/source/core/ut_suite_manager.pks index 9b214a6c2..5b7c705c6 100644 --- a/source/core/ut_suite_manager.pks +++ b/source/core/ut_suite_manager.pks @@ -50,7 +50,7 @@ create or replace package ut_suite_manager authid current_user is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); /** diff --git a/source/create_synonyms_and_grants_for_public.sql b/source/create_synonyms_and_grants_for_public.sql index 609d78ccf..6cc40afdc 100644 --- a/source/create_synonyms_and_grants_for_public.sql +++ b/source/create_synonyms_and_grants_for_public.sql @@ -93,6 +93,7 @@ grant select on &&ut3_owner..ut_annotation_cache to public; grant execute on &&ut3_owner..ut_executables to public; grant execute on &&ut3_owner..ut_executable_test to public; grant select on &&ut3_owner..ut_suite_cache to public; +grant select on &&ut3_owner..ut_suite_cache_tag to public; grant select on &&ut3_owner..ut_suite_cache_package to public; grant select on &&ut3_owner..ut_suite_cache_schema to public; grant execute on &&ut3_owner..ut_annotation_cache_manager to public; diff --git a/source/create_user_grants.sql b/source/create_user_grants.sql index 7aa5deb39..ace73b951 100644 --- a/source/create_user_grants.sql +++ b/source/create_user_grants.sql @@ -114,6 +114,7 @@ grant select on &&ut3_owner..ut_annotation_cache to &ut3_user; grant execute on &&ut3_owner..ut_executables to &ut3_user; grant execute on &&ut3_owner..ut_executable_test to &ut3_user; grant select on &&ut3_owner..ut_suite_cache to &ut3_user; +grant select on &&ut3_owner..ut_suite_cache_tag to &ut3_user; grant select on &&ut3_owner..ut_suite_cache_package to public; grant select on &&ut3_owner..ut_suite_cache_schema to &ut3_user; grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user; diff --git a/source/install.sql b/source/install.sql index 728f4349f..86669c11d 100644 --- a/source/install.sql +++ b/source/install.sql @@ -130,6 +130,7 @@ alter session set current_schema = &&ut3_owner; @@install_component.sql 'core/ut_suite_cache_package.sql' @@install_component.sql 'core/ut_suite_cache_seq.sql' @@install_component.sql 'core/ut_suite_cache.sql' +@@install_component.sql 'core/ut_suite_cache_tag.sql' @@install_component.sql 'core/ut_suite_cache_manager.pks' @@install_component.sql 'core/ut_suite_cache_manager.pkb' @@install_component.sql 'core/ut_suite_builder.pks' diff --git a/source/uninstall_objects.sql b/source/uninstall_objects.sql index e2295f34d..e68b50664 100644 --- a/source/uninstall_objects.sql +++ b/source/uninstall_objects.sql @@ -63,6 +63,8 @@ drop package ut_suite_manager; drop package ut_suite_builder; +drop table ut_suite_cache_tag; + drop table ut_suite_cache; drop sequence ut_suite_cache_seq; diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 7ef85a53a..71d3d32a0 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -897,7 +897,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - '' || + '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -907,7 +907,7 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || - '' || + '' || '' ); end; From d2f9796446234f6b40fd417217ade24e5bf6a22e Mon Sep 17 00:00:00 2001 From: lwasylow Date: Fri, 19 Apr 2019 21:04:55 +0100 Subject: [PATCH 03/23] Switch to use VARCHAR2 instead of UT_VARCHAR2_ROWS() Signed-off-by: lwasylow --- source/api/ut.pkb | 28 ++++++------- source/api/ut.pks | 4 +- source/api/ut_runner.pkb | 13 ++---- source/api/ut_runner.pks | 2 +- source/core/types/ut_run.tpb | 2 +- source/core/types/ut_run.tps | 4 +- source/core/types/ut_suite.tpb | 4 +- source/core/types/ut_suite.tps | 4 +- source/core/types/ut_test.tpb | 4 +- source/core/types/ut_test.tps | 4 +- source/core/ut_suite_builder.pkb | 15 +++---- source/core/ut_suite_cache.sql | 3 +- source/core/ut_suite_cache_manager.pkb | 17 +++++++- source/core/ut_suite_cache_tag.sql | 7 ++++ source/core/ut_suite_manager.pkb | 40 +++++++++---------- source/core/ut_suite_manager.pks | 2 +- .../create_synonyms_and_grants_for_public.sql | 1 + source/create_user_grants.sql | 1 + source/install.sql | 1 + source/uninstall_objects.sql | 2 + test/ut3_tester/core/test_suite_builder.pkb | 14 +++---- 21 files changed, 92 insertions(+), 80 deletions(-) create mode 100644 source/core/ut_suite_cache_tag.sql diff --git a/source/api/ut.pkb b/source/api/ut.pkb index 96cf51102..1a95f0725 100644 --- a/source/api/ut.pkb +++ b/source/api/ut.pkb @@ -121,7 +121,7 @@ create or replace package body ut is a_client_character_set varchar2, a_random_test_order integer, a_random_test_order_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is pragma autonomous_transaction; begin @@ -157,7 +157,7 @@ create or replace package body ut is a_client_character_set varchar2, a_random_test_order integer, a_random_test_order_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is pragma autonomous_transaction; begin @@ -234,7 +234,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -273,7 +273,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -313,7 +313,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -353,7 +353,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -393,7 +393,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -433,7 +433,7 @@ create or replace package body ut is a_client_character_set, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); if l_reporter is of (ut_output_reporter_base) then l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); @@ -457,7 +457,7 @@ create or replace package body ut is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_reporter ut_reporter_base := a_reporter; begin @@ -514,7 +514,7 @@ create or replace package body ut is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_reporter ut_reporter_base := a_reporter; begin @@ -563,7 +563,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; @@ -595,7 +595,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; @@ -628,7 +628,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; @@ -661,7 +661,7 @@ create or replace package body ut is a_force_manual_rollback, a_random_test_order, a_random_test_order_seed, - ut_varchar2_rows(a_tags) + a_tags ); end; diff --git a/source/api/ut.pks b/source/api/ut.pks index e6065d85b..17b4a845e 100644 --- a/source/api/ut.pks +++ b/source/api/ut.pks @@ -178,7 +178,7 @@ create or replace package ut authid current_user as a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); procedure run( @@ -194,7 +194,7 @@ create or replace package ut authid current_user as a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); procedure run( diff --git a/source/api/ut_runner.pkb b/source/api/ut_runner.pkb index 3d262abe3..30cdf2691 100644 --- a/source/api/ut_runner.pkb +++ b/source/api/ut_runner.pkb @@ -91,7 +91,7 @@ create or replace package body ut_runner is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_run ut_run; l_coverage_schema_names ut_varchar2_rows; @@ -99,7 +99,6 @@ create or replace package body ut_runner is l_include_object_names ut_object_names; l_paths ut_varchar2_list := ut_varchar2_list(); l_random_test_order_seed positive; - l_tags ut_varchar2_rows := ut_varchar2_rows(); begin ut_event_manager.initialize(); if a_reporters is not empty then @@ -126,12 +125,6 @@ create or replace package body ut_runner is end loop; end if; - if (a_tags is not null) or not(a_tags is empty) then - for i in 1..a_tags.count loop - l_tags := l_tags multiset union ut_utils.convert_collection(ut_utils.string_to_table(a_string => a_tags(i),a_delimiter => ',')); - end loop; - end if; - begin ut_expectation_processor.reset_invalidation_exception(); ut_utils.save_dbms_output_to_cache(); @@ -161,10 +154,10 @@ create or replace package body ut_runner is set(a_test_file_mappings), a_client_character_set, l_random_test_order_seed, - l_tags + a_tags ); - ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, l_tags); + ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, a_tags); if a_force_manual_rollback then l_run.set_rollback_type( a_rollback_type => ut_utils.gc_rollback_manual, a_force => true ); end if; diff --git a/source/api/ut_runner.pks b/source/api/ut_runner.pks index 895de3bb7..0434790f5 100644 --- a/source/api/ut_runner.pks +++ b/source/api/ut_runner.pks @@ -71,7 +71,7 @@ create or replace package ut_runner authid current_user is a_force_manual_rollback boolean := false, a_random_test_order boolean := false, a_random_test_order_seed positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); /** diff --git a/source/core/types/ut_run.tpb b/source/core/types/ut_run.tpb index c8f2778ff..d26c6fcb4 100644 --- a/source/core/types/ut_run.tpb +++ b/source/core/types/ut_run.tpb @@ -27,7 +27,7 @@ create or replace type body ut_run as a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, a_random_test_order_seed positive := null, - a_run_tags ut_varchar2_rows := null + a_run_tags varchar2 := null ) return self as result is begin self.run_paths := a_run_paths; diff --git a/source/core/types/ut_run.tps b/source/core/types/ut_run.tps index b5a1d18ac..7ea5cc605 100644 --- a/source/core/types/ut_run.tps +++ b/source/core/types/ut_run.tps @@ -21,7 +21,7 @@ create or replace type ut_run under ut_suite_item ( project_name varchar2(4000), items ut_suite_items, run_paths ut_varchar2_list, - run_tags ut_varchar2_rows, + run_tags varchar2(4000), coverage_options ut_coverage_options, test_file_mappings ut_file_mappings, client_character_set varchar2(100), @@ -37,7 +37,7 @@ create or replace type ut_run under ut_suite_item ( a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, a_random_test_order_seed positive := null, - a_run_tags ut_varchar2_rows := null + a_run_tags varchar2 := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_run), overriding member function do_execute(self in out nocopy ut_run) return boolean, diff --git a/source/core/types/ut_suite.tpb b/source/core/types/ut_suite.tpb index bf683d8aa..bd35d18ca 100644 --- a/source/core/types/ut_suite.tpb +++ b/source/core/types/ut_suite.tpb @@ -18,7 +18,7 @@ create or replace type body ut_suite as constructor function ut_suite ( self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, - a_suite_tags ut_varchar2_rows := null + a_tags varchar2 := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -26,7 +26,7 @@ create or replace type body ut_suite as self.items := ut_suite_items(); before_all_list := ut_executables(); after_all_list := ut_executables(); - self.suite_tags := a_suite_tags; + self.tags := a_tags; return; end; diff --git a/source/core/types/ut_suite.tps b/source/core/types/ut_suite.tps index 0da911b4f..0bcddd59b 100644 --- a/source/core/types/ut_suite.tps +++ b/source/core/types/ut_suite.tps @@ -29,10 +29,10 @@ create or replace type ut_suite under ut_logical_suite ( /** * Hold list of tags assign to suite */ - suite_tags ut_varchar2_rows, + tags varchar2(4000), constructor function ut_suite ( self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, - a_suite_tags ut_varchar2_rows := null + a_tags varchar2 := null ) return self as result, overriding member function do_execute(self in out nocopy ut_suite) return boolean, overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list, diff --git a/source/core/types/ut_test.tpb b/source/core/types/ut_test.tpb index f09a51162..c1d847bf5 100644 --- a/source/core/types/ut_test.tpb +++ b/source/core/types/ut_test.tpb @@ -18,7 +18,7 @@ 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_line_no integer, a_expected_error_codes ut_integer_list := null, a_test_tags ut_varchar2_rows := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags varchar2 := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -31,7 +31,7 @@ create or replace type body ut_test as self.all_expectations := ut_expectation_results(); self.failed_expectations := ut_expectation_results(); self.expected_error_codes := a_expected_error_codes; - self.test_tags := a_test_tags; + self.tags := a_tags; return; end; diff --git a/source/core/types/ut_test.tps b/source/core/types/ut_test.tps index caabdf1b1..23116119c 100644 --- a/source/core/types/ut_test.tps +++ b/source/core/types/ut_test.tps @@ -58,10 +58,10 @@ create or replace type ut_test force under ut_suite_item ( /** * Hold list of tags assign to test */ - test_tags ut_varchar2_rows, + tags 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_line_no integer, a_expected_error_codes ut_integer_list := null, a_test_tags ut_varchar2_rows := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags varchar2 := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_test), overriding member function do_execute(self in out nocopy ut_test) return boolean, diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index 2a6a810e3..e11c91a2b 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -309,13 +309,12 @@ create or replace package body ut_suite_builder is procedure add_tags_to_test( a_suite in out nocopy ut_suite, - a_list in out nocopy ut_varchar2_rows, + a_list in out nocopy varchar2, a_procedure_name t_object_name, a_tags_ann_text tt_annotation_texts ) is l_annotation_pos binary_integer; begin - a_list := ut_varchar2_rows(); l_annotation_pos := a_tags_ann_text.first; while l_annotation_pos is not null loop if a_tags_ann_text(l_annotation_pos) is null then @@ -325,8 +324,7 @@ create or replace package body ut_suite_builder is ); else a_list := - a_list multiset union - ut_utils.convert_collection(ut_utils.trim_list_elements(ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos), ',', 'Y'))); + a_list || a_tags_ann_text(l_annotation_pos); end if; l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; @@ -514,7 +512,7 @@ create or replace package body ut_suite_builder is end if; if l_proc_annotations.exists( gc_tag) then - add_tags_to_test(a_suite, l_test.test_tags, a_procedure_name, l_proc_annotations( gc_tag)); + add_tags_to_test(a_suite, l_test.tags, a_procedure_name, l_proc_annotations( gc_tag)); end if; if l_proc_annotations.exists( gc_throws) then @@ -623,7 +621,7 @@ create or replace package body ut_suite_builder is a_tags_ann_text tt_annotation_texts ) is l_annotation_pos binary_integer; - l_tags ut_varchar2_rows := ut_varchar2_rows(); + l_tags varchar2(4000); begin l_annotation_pos := a_tags_ann_text.first; while l_annotation_pos is not null loop @@ -633,12 +631,11 @@ create or replace package body ut_suite_builder is ); else l_tags := - l_tags multiset union - ut_utils.convert_collection(ut_utils.trim_list_elements(ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos), ',', 'Y'))); + l_tags || a_tags_ann_text(l_annotation_pos); end if; l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; - a_suite.suite_tags := l_tags; + a_suite.tags := l_tags; end; procedure add_suite_tests( diff --git a/source/core/ut_suite_cache.sql b/source/core/ut_suite_cache.sql index e41af9607..3a38ceeb7 100644 --- a/source/core/ut_suite_cache.sql +++ b/source/core/ut_suite_cache.sql @@ -47,7 +47,6 @@ create table ut_suite_cache ( nested table before_test_list store as ut_suite_cache_before_test nested table after_test_list store as ut_suite_cache_after_test nested table expected_error_codes store as ut_suite_cache_throws - nested table tags store as ut_suite_cache_tags return as locator as select cast(null as number(22)) id, @@ -69,7 +68,7 @@ create table ut_suite_cache ( t.after_each_list, t.after_test_list, t.expected_error_codes, - t.test_tags, + t.tags, t.item from table(ut_suite_contexts(ut_suite_context(user,'package_name','ctx_name',1))) c cross join table(ut_tests(ut_test(user,'package_name','test_name',1))) t diff --git a/source/core/ut_suite_cache_manager.pkb b/source/core/ut_suite_cache_manager.pkb index 55a6816e0..526a03338 100644 --- a/source/core/ut_suite_cache_manager.pkb +++ b/source/core/ut_suite_cache_manager.pkb @@ -104,7 +104,7 @@ create or replace package body ut_suite_cache_manager is s.i.before_all_list as before_all_list, s.i.after_all_list as after_all_list, null before_each_list, null after_each_list, null before_test_list, null after_test_list, - null expected_error_codes, s.i.suite_tags tags, + null expected_error_codes, s.i.tags tags, null item from suites s; @@ -130,9 +130,22 @@ create or replace package body ut_suite_cache_manager is null before_all_list, null after_all_list, s.t.before_each_list as before_each_list, s.t.after_each_list as after_each_list, s.t.before_test_list as before_test_list, s.t.after_test_list as after_test_list, - s.t.expected_error_codes as expected_error_codes, s.t.test_tags as test_tags, + s.t.expected_error_codes as expected_error_codes, s.t.tags as test_tags, s.t.item as item from tests s; + + --TODO : Optimize to use only inserted + merge into ut_suite_cache_tag tgt + using ( select /*+cardinality (tt 100) */ t.id,tt.column_value tag + from ut_suite_cache t, + table(ut_utils.convert_collection((ut_utils.string_to_table(t.tags,',')))) tt + where tt.column_value is not null ) src + on ( tgt.suiteid = src.id and tgt.tagname = src.tag) + when not matched then + insert + (suiteid, tagname ) + values + (src.id, src.tag); end if; end if; diff --git a/source/core/ut_suite_cache_tag.sql b/source/core/ut_suite_cache_tag.sql new file mode 100644 index 000000000..17d287dd8 --- /dev/null +++ b/source/core/ut_suite_cache_tag.sql @@ -0,0 +1,7 @@ +create table ut_suite_cache_tag ( + suiteid number(22) not null, + tagname varchar2(100) not null, + constraint ut_suite_to_tag_pk primary key (suiteid,tagname), + constraint ut_suite_id_fk foreign key ( suiteid ) references ut_suite_cache(id) on delete cascade +) +organization index; \ No newline at end of file diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index ad433b8da..54bf8fa04 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -193,7 +193,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) else ut_suite( @@ -206,7 +206,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) end; when 'UT_SUITE_CONTEXT' then @@ -222,7 +222,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) else ut_suite_context( @@ -235,7 +235,7 @@ create or replace package body ut_suite_manager is 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), suite_tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags --TODO : Should be share or separate ) end; when 'UT_LOGICAL_SUITE' then @@ -278,7 +278,7 @@ create or replace package body ut_suite_manager is 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, - test_tags => a_rows(a_idx).tags + tags => a_rows(a_idx).tags ); end case; l_result.results_count.warnings_count := l_result.warnings.count; @@ -363,14 +363,14 @@ create or replace package body ut_suite_manager is a_procedure_name varchar2 := null, a_skip_all_objects boolean := false, a_random_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) return t_cached_suites_cursor is l_path varchar2( 4000 ); l_result sys_refcursor; l_ut_owner varchar2(250) := ut_utils.ut_owner; l_sql varchar2(32767); - l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows()); l_suite_item_name varchar2(20); + l_tag_list varchar2(4000) :=a_tags; begin if a_path is null and a_object_name is not null then execute immediate 'select min(path) @@ -382,8 +382,7 @@ create or replace package body ut_suite_manager is else l_path := lower( a_path ); end if; - - l_suite_item_name := case when l_tags.count > 0 then 'suite_items_tags' else 'suite_items' end; + l_suite_item_name := case when l_tag_list is not null then 'suite_items_tags' else 'suite_items' end; /* Rewrite that as tags should be put on whats left not on full suite item cache */ l_sql := @@ -415,13 +414,13 @@ create or replace package body ut_suite_manager is ) ) ),]' - ||case when l_tags.count > 0 then + ||case when l_tag_list is not null then q'[ filter_tags as ( select s.* from suite_items s where exists ( select 1 - from table(s.tags) ct,table(:l_tags) tag - where ct.column_value = tag.column_value) + from ]'||l_ut_owner||q'[.ut_suite_cache_tag ct + where ct.suiteid = s.id and instr(:a_tag_list,ct.tagname) > 0 ) ), suite_items_tags as ( select c.* from suite_items c @@ -431,7 +430,7 @@ create or replace package body ut_suite_manager is ) ),]' else - q'[dummy as (select 1 from table(:l_tags) where 1 = 2 ),]' + q'[dummy as (select 'x' from dual where :a_tag_list is null ),]' end|| q'[ suitepaths as ( select distinct substr(path,1,instr(path,'.',-1)-1) as suitepath, @@ -457,7 +456,6 @@ create or replace package body ut_suite_manager is upper( substr(p.path, instr( p.path, '.', -1 ) + 1 ) ) as object_name, cast(null as ]'||l_ut_owner||q'[.ut_executables) as x, cast(null as ]'||l_ut_owner||q'[.ut_integer_list) as y, - cast(null as ]'||l_ut_owner||q'[.ut_varchar2_rows) as q, cast(null as ]'||l_ut_owner||q'[.ut_executable_test) as z from suitepath_part p where p.path @@ -471,7 +469,7 @@ create or replace package body ut_suite_manager is s.x as before_all_list, s.x as after_all_list, s.x as before_each_list, s.x as before_test_list, s.x as after_each_list, s.x as after_test_list, - s.y as expected_error_codes, s.q as test_tags, + s.y as expected_error_codes, null as test_tags, s.z as item from logical_suite_data s ), @@ -499,8 +497,8 @@ create or replace package body ut_suite_manager is l_ut_owner||'.ut_annotation_manager.hash_suite_path( c.path, :a_random_seed ) desc nulls last' - end; - open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tags, a_random_seed; + end; + open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tag_list, a_random_seed; return l_result; end; @@ -588,7 +586,7 @@ create or replace package body ut_suite_manager is a_procedure_name varchar2 := null, a_suites in out nocopy ut_suite_items, a_random_seed positive, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is begin refresh_cache(a_owner_name); @@ -695,7 +693,7 @@ create or replace package body ut_suite_manager is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ) is l_paths ut_varchar2_list := a_paths; l_path_items t_path_items; @@ -736,8 +734,8 @@ create or replace package body ut_suite_manager is raise_application_error(ut_utils.gc_suite_package_not_found,'Suite test '||l_schema||'.'||l_path_item.object_name|| '.'||l_path_item.procedure_name||' does not exist'); elsif l_path_item.object_name is not null then raise_application_error(ut_utils.gc_suite_package_not_found,'Suite package '||l_schema||'.'||l_path_item.object_name|| ' does not exist'); - elsif a_tags.count > 0 then - raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for tags: '||ut_utils.to_string(ut_utils.table_to_clob(a_tags,','),a_max_output_len => 450)); + elsif a_tags is not null then + raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for tags: '||ut_utils.to_string(a_tags,a_max_output_len => 450)); end if; end if; l_index := a_suites.first; diff --git a/source/core/ut_suite_manager.pks b/source/core/ut_suite_manager.pks index 9b214a6c2..5b7c705c6 100644 --- a/source/core/ut_suite_manager.pks +++ b/source/core/ut_suite_manager.pks @@ -50,7 +50,7 @@ create or replace package ut_suite_manager authid current_user is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags ut_varchar2_rows := null + a_tags varchar2 := null ); /** diff --git a/source/create_synonyms_and_grants_for_public.sql b/source/create_synonyms_and_grants_for_public.sql index 609d78ccf..6cc40afdc 100644 --- a/source/create_synonyms_and_grants_for_public.sql +++ b/source/create_synonyms_and_grants_for_public.sql @@ -93,6 +93,7 @@ grant select on &&ut3_owner..ut_annotation_cache to public; grant execute on &&ut3_owner..ut_executables to public; grant execute on &&ut3_owner..ut_executable_test to public; grant select on &&ut3_owner..ut_suite_cache to public; +grant select on &&ut3_owner..ut_suite_cache_tag to public; grant select on &&ut3_owner..ut_suite_cache_package to public; grant select on &&ut3_owner..ut_suite_cache_schema to public; grant execute on &&ut3_owner..ut_annotation_cache_manager to public; diff --git a/source/create_user_grants.sql b/source/create_user_grants.sql index 7aa5deb39..ace73b951 100644 --- a/source/create_user_grants.sql +++ b/source/create_user_grants.sql @@ -114,6 +114,7 @@ grant select on &&ut3_owner..ut_annotation_cache to &ut3_user; grant execute on &&ut3_owner..ut_executables to &ut3_user; grant execute on &&ut3_owner..ut_executable_test to &ut3_user; grant select on &&ut3_owner..ut_suite_cache to &ut3_user; +grant select on &&ut3_owner..ut_suite_cache_tag to &ut3_user; grant select on &&ut3_owner..ut_suite_cache_package to public; grant select on &&ut3_owner..ut_suite_cache_schema to &ut3_user; grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user; diff --git a/source/install.sql b/source/install.sql index 728f4349f..86669c11d 100644 --- a/source/install.sql +++ b/source/install.sql @@ -130,6 +130,7 @@ alter session set current_schema = &&ut3_owner; @@install_component.sql 'core/ut_suite_cache_package.sql' @@install_component.sql 'core/ut_suite_cache_seq.sql' @@install_component.sql 'core/ut_suite_cache.sql' +@@install_component.sql 'core/ut_suite_cache_tag.sql' @@install_component.sql 'core/ut_suite_cache_manager.pks' @@install_component.sql 'core/ut_suite_cache_manager.pkb' @@install_component.sql 'core/ut_suite_builder.pks' diff --git a/source/uninstall_objects.sql b/source/uninstall_objects.sql index e2295f34d..e68b50664 100644 --- a/source/uninstall_objects.sql +++ b/source/uninstall_objects.sql @@ -63,6 +63,8 @@ drop package ut_suite_manager; drop package ut_suite_builder; +drop table ut_suite_cache_tag; + drop table ut_suite_cache; drop sequence ut_suite_cache_seq; diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 7ef85a53a..17fbca74a 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -652,7 +652,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - '' || + '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -662,7 +662,7 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || - '' || + '' || '' ); end; @@ -798,7 +798,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - ''|| + ''|| '' ); end; @@ -840,7 +840,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - '' || + '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -850,7 +850,7 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || - '' || + '' || '' ); end; @@ -897,7 +897,7 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - '' || + '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -907,7 +907,7 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || - '' || + '' || '' ); end; From 1a941a8698714e484079a40dbdd1e5375eae148a Mon Sep 17 00:00:00 2001 From: lwasylow Date: Sat, 20 Apr 2019 18:36:43 +0100 Subject: [PATCH 04/23] Adding Tests to tags #suitebuilder --- source/core/ut_suite_builder.pkb | 20 +- source/core/ut_utils.pkb | 1 - test/ut3_tester/core/test_suite_builder.pkb | 300 ++++++++++++++++++++ test/ut3_tester/core/test_suite_builder.pks | 47 +++ 4 files changed, 361 insertions(+), 7 deletions(-) diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index e11c91a2b..ccb91c203 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -314,6 +314,7 @@ create or replace package body ut_suite_builder is a_tags_ann_text tt_annotation_texts ) is l_annotation_pos binary_integer; + l_tag_list ut_varchar2_list := ut_varchar2_list(); begin l_annotation_pos := a_tags_ann_text.first; while l_annotation_pos is not null loop @@ -323,9 +324,13 @@ create or replace package body ut_suite_builder is || chr( 10 ) || 'at "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || l_annotation_pos ); else - a_list := - a_list || a_tags_ann_text(l_annotation_pos); + l_tag_list := l_tag_list multiset union distinct ut_utils.trim_list_elements( + ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos),',') + ); end if; + a_list := ut_utils.table_to_clob( + ut_utils.filter_list(l_tag_list,'^(\w|\S)+$'), + ','); l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; @@ -621,7 +626,7 @@ create or replace package body ut_suite_builder is a_tags_ann_text tt_annotation_texts ) is l_annotation_pos binary_integer; - l_tags varchar2(4000); + l_tag_list ut_varchar2_list := ut_varchar2_list(); begin l_annotation_pos := a_tags_ann_text.first; while l_annotation_pos is not null loop @@ -630,12 +635,15 @@ create or replace package body ut_suite_builder is '"--%tag" annotation requires a tag value populated. Annotation ignored, line ' || l_annotation_pos ); else - l_tags := - l_tags || a_tags_ann_text(l_annotation_pos); + l_tag_list := l_tag_list multiset union distinct ut_utils.trim_list_elements( + ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos),',') + ); end if; l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; - a_suite.tags := l_tags; + a_suite.tags := ut_utils.table_to_clob( + ut_utils.filter_list(l_tag_list,'^(\w|\S)+$'), + ','); end; procedure add_suite_tests( diff --git a/source/core/ut_utils.pkb b/source/core/ut_utils.pkb index be8da247e..64aa57af9 100644 --- a/source/core/ut_utils.pkb +++ b/source/core/ut_utils.pkb @@ -610,7 +610,6 @@ create or replace package body ut_utils is if a_list is not null then l_filtered_list := ut_varchar2_list(); l_index := a_list.first; - while (l_index is not null) loop if regexp_like(a_list(l_index), a_regexp_filter) then l_filtered_list.extend; diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 17fbca74a..6d9289d3c 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -1121,5 +1121,305 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_match('(.*)(Unsupported annotation "--%bad_package_annotation"\. Annotation ignored\.)(.*)( line 17)(.*)', 'n'); end; + procedure test_tag_annotation is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), + ut3.ut_annotation(9, 'tag','testtag', 'test_procedure') + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%test_procedureSome testsome_package.test_procedure' || + '%testtag%'|| + '%%' + ); + + end; + + procedure suite_tag_annotation is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(3, 'tag','suitetag', null) + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%some_packagetestsuitesome_package' || + '%suitetag%'|| + '%%' + ); + + end; + + procedure test_tags_annotation is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), + ut3.ut_annotation(9, 'tag','testtag,testtag2,testtag3', 'test_procedure') + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%test_procedureSome testsome_package.test_procedure' || + '%testtag,testtag2,testtag3%'|| + '%%' + ); + + end; + + procedure suite_tags_annotation is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(3, 'tag','suitetag,suitetag1,suitetag2', null) + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%some_packagetestsuitesome_package' || + '%suitetag,suitetag1,suitetag2%'|| + '%%' + ); + + end; + + procedure test_2line_tags_annotation is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), + ut3.ut_annotation(9, 'tag','testtag', 'test_procedure'), + ut3.ut_annotation(10, 'tag','testtag2', 'test_procedure') + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%test_procedureSome testsome_package.test_procedure' || + '%testtag,testtag2%'|| + '%%' + ); + + end; + + procedure suite_2line_tags_annotation is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(3, 'tag','suitetag', null), + ut3.ut_annotation(4, 'tag','suitetag1', null) + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%some_packagetestsuitesome_package' || + '%suitetag,suitetag1%'|| + '%%' + ); + + end; + + procedure test_empty_tag is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), + ut3.ut_annotation(9, 'tag',null, 'test_procedure') + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%%"--%tag" annotation requires a tag value populated. Annotation ignored.%%'|| + '%%' + ); + + end; + + procedure suite_empty_tag is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(3, 'tag',null, null) + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%"--%tag" annotation requires a tag value populated. Annotation ignored, line 3%'|| + '%%' + ); + + end; + + procedure test_duplicate_tag is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), + ut3.ut_annotation(9, 'tag','testtag,testtag1,testtag', 'test_procedure'), + ut3.ut_annotation(10, 'tag',' testtag,testtag1,testtag2', 'test_procedure') + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%test_procedureSome testsome_package.test_procedure' || + '%testtag,testtag1,testtag2%'|| + '%%' + ); + + end; + + procedure suite_duplicate_tag is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(3, 'tag','suitetag,suitetag1,suitetag', null), + ut3.ut_annotation(4, 'tag',' suitetag1,suitetag2', null) + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%some_packagetestsuitesome_package' || + '%suitetag,suitetag1,suitetag2%'|| + '%%' + ); + + end; + + procedure test_empty_tag_between is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), + ut3.ut_annotation(9, 'tag','testtag,, ,testtag1', 'test_procedure') + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%test_procedureSome testsome_package.test_procedure' || + '%testtag,testtag1%'|| + '%%' + ); + + end; + + procedure suite_empty_tag_between is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(3, 'tag','suitetag,, ,suitetag1', null) + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%some_packagetestsuitesome_package' || + '%suitetag,suitetag1%'|| + '%%' + ); + + end; + + procedure test_special_char_tag is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), + ut3.ut_annotation(9, 'tag','#?$%^&*!|\/@][', 'test_procedure') + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%test_procedureSome testsome_package.test_procedure' || + '%#?$%^&*!|\/@][%'|| + '%%' + ); + + end; + + procedure suite_special_char_tag is + l_actual clob; + l_annotations ut3.ut_annotations; + begin + --Arrange + l_annotations := ut3.ut_annotations( + ut3.ut_annotation(2, 'suite','testsuite', null), + ut3.ut_annotation(3, 'tag','#?$%^&*!|\/@][', null) + ); + --Act + l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); + --Assert + ut.expect(l_actual).to_be_like( + '%' || + '%some_packagetestsuitesome_package' || + '%#?$%^&*!|\/@][%'|| + '%%' + ); + + end; + end test_suite_builder; / diff --git a/test/ut3_tester/core/test_suite_builder.pks b/test/ut3_tester/core/test_suite_builder.pks index 5715cfd85..721db153f 100644 --- a/test/ut3_tester/core/test_suite_builder.pks +++ b/test/ut3_tester/core/test_suite_builder.pks @@ -172,5 +172,52 @@ create or replace package test_suite_builder is --%endcontext + --%context(tags_annotation) + --%displayname(--%tag_annotation) + + --%test(Build suite test with tag) + procedure test_tag_annotation; + + --%test(Build suite with tag) + procedure suite_tag_annotation; + + --%test(Build suite test with three tags) + procedure test_tags_annotation; + + --%test(Build suite with three tags) + procedure suite_tags_annotation; + + --%test(Build suite test with two line tag annotation) + procedure test_2line_tags_annotation; + + --%test(Build suite with two line tag annotation) + procedure suite_2line_tags_annotation; + + --%test(Build suite test with empty line tag annotation) + procedure test_empty_tag; + + --%test(Build suite with empty line tag annotation) + procedure suite_empty_tag; + + --%test(Build suite test with duplicate tag annotation) + procedure test_duplicate_tag; + + --%test(Build suite with duplicate tag annotation) + procedure suite_duplicate_tag; + + --%test(Build suite test with empty between tag annotation) + procedure test_empty_tag_between; + + --%test(Build suite with empty between tag annotation) + procedure suite_empty_tag_between; + + --%test(Build suite test with special char tag annotation) + procedure test_special_char_tag; + + --%test(Build suite with special char tag annotation) + procedure suite_special_char_tag; + + --%endcontext + end test_suite_builder; / From 3a8ba8f4fae4df30b2c97166675460bc2aa07335 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Sun, 21 Apr 2019 07:47:27 +0100 Subject: [PATCH 05/23] Change annotation to --%tags --- source/core/ut_suite_builder.pkb | 2 +- test/ut3_tester/core/test_suite_builder.pkb | 36 ++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index ccb91c203..ab4920e9c 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -23,7 +23,7 @@ create or replace package body ut_suite_builder is gc_suite constant t_annotation_name := 'suite'; gc_suitepath constant t_annotation_name := 'suitepath'; - gc_tag constant t_annotation_name := 'tag'; + gc_tag constant t_annotation_name := 'tags'; gc_test constant t_annotation_name := ut_utils.gc_test_execute; gc_disabled constant t_annotation_name := 'disabled'; gc_displayname constant t_annotation_name := 'displayname'; diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 6d9289d3c..8f8308f4f 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -1129,7 +1129,7 @@ create or replace package body test_suite_builder is l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), - ut3.ut_annotation(9, 'tag','testtag', 'test_procedure') + ut3.ut_annotation(9, 'tags','testtag', 'test_procedure') ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1150,7 +1150,7 @@ create or replace package body test_suite_builder is --Arrange l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), - ut3.ut_annotation(3, 'tag','suitetag', null) + ut3.ut_annotation(3, 'tags','suitetag', null) ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1172,7 +1172,7 @@ create or replace package body test_suite_builder is l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), - ut3.ut_annotation(9, 'tag','testtag,testtag2,testtag3', 'test_procedure') + ut3.ut_annotation(9, 'tags','testtag,testtag2,testtag3', 'test_procedure') ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1193,7 +1193,7 @@ create or replace package body test_suite_builder is --Arrange l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), - ut3.ut_annotation(3, 'tag','suitetag,suitetag1,suitetag2', null) + ut3.ut_annotation(3, 'tags','suitetag,suitetag1,suitetag2', null) ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1215,8 +1215,8 @@ create or replace package body test_suite_builder is l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), - ut3.ut_annotation(9, 'tag','testtag', 'test_procedure'), - ut3.ut_annotation(10, 'tag','testtag2', 'test_procedure') + ut3.ut_annotation(9, 'tags','testtag', 'test_procedure'), + ut3.ut_annotation(10, 'tags','testtag2', 'test_procedure') ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1237,8 +1237,8 @@ create or replace package body test_suite_builder is --Arrange l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), - ut3.ut_annotation(3, 'tag','suitetag', null), - ut3.ut_annotation(4, 'tag','suitetag1', null) + ut3.ut_annotation(3, 'tags','suitetag', null), + ut3.ut_annotation(4, 'tags','suitetag1', null) ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1259,7 +1259,7 @@ create or replace package body test_suite_builder is l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), - ut3.ut_annotation(9, 'tag',null, 'test_procedure') + ut3.ut_annotation(9, 'tags',null, 'test_procedure') ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1278,7 +1278,7 @@ create or replace package body test_suite_builder is --Arrange l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), - ut3.ut_annotation(3, 'tag',null, null) + ut3.ut_annotation(3, 'tags',null, null) ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1298,8 +1298,8 @@ create or replace package body test_suite_builder is l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), - ut3.ut_annotation(9, 'tag','testtag,testtag1,testtag', 'test_procedure'), - ut3.ut_annotation(10, 'tag',' testtag,testtag1,testtag2', 'test_procedure') + ut3.ut_annotation(9, 'tags','testtag,testtag1,testtag', 'test_procedure'), + ut3.ut_annotation(10, 'tags',' testtag,testtag1,testtag2', 'test_procedure') ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1320,8 +1320,8 @@ create or replace package body test_suite_builder is --Arrange l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), - ut3.ut_annotation(3, 'tag','suitetag,suitetag1,suitetag', null), - ut3.ut_annotation(4, 'tag',' suitetag1,suitetag2', null) + ut3.ut_annotation(3, 'tags','suitetag,suitetag1,suitetag', null), + ut3.ut_annotation(4, 'tags',' suitetag1,suitetag2', null) ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1343,7 +1343,7 @@ create or replace package body test_suite_builder is l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), - ut3.ut_annotation(9, 'tag','testtag,, ,testtag1', 'test_procedure') + ut3.ut_annotation(9, 'tags','testtag,, ,testtag1', 'test_procedure') ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1364,7 +1364,7 @@ create or replace package body test_suite_builder is --Arrange l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), - ut3.ut_annotation(3, 'tag','suitetag,, ,suitetag1', null) + ut3.ut_annotation(3, 'tags','suitetag,, ,suitetag1', null) ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1386,7 +1386,7 @@ create or replace package body test_suite_builder is l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), ut3.ut_annotation(8, 'test','Some test', 'test_procedure'), - ut3.ut_annotation(9, 'tag','#?$%^&*!|\/@][', 'test_procedure') + ut3.ut_annotation(9, 'tags','#?$%^&*!|\/@][', 'test_procedure') ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); @@ -1407,7 +1407,7 @@ create or replace package body test_suite_builder is --Arrange l_annotations := ut3.ut_annotations( ut3.ut_annotation(2, 'suite','testsuite', null), - ut3.ut_annotation(3, 'tag','#?$%^&*!|\/@][', null) + ut3.ut_annotation(3, 'tags','#?$%^&*!|\/@][', null) ); --Act l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); From 8ebb8b859bbce58eead838e3a6a501bbda2bb996 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Sun, 21 Apr 2019 12:34:42 +0100 Subject: [PATCH 06/23] Fixing empty tags to use xmlgen --- test/ut3_tester/core/test_suite_builder.pkb | 37 ++++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 8f8308f4f..d6f1a8b66 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -7,6 +7,8 @@ create or replace package body test_suite_builder is l_suites ut3.ut_suite_items; l_suite ut3.ut_logical_suite; l_cursor sys_refcursor; + l_type_cursor sys_refcursor; + l_ctx dbms_xmlgen.ctxhandle; l_xml xmltype; begin open l_cursor for select value(x) from table( @@ -22,9 +24,14 @@ create or replace package body test_suite_builder is a_skip_all_objects => true ); l_suite := treat( l_suites(l_suites.first) as ut3.ut_logical_suite); - + + open l_type_cursor for select l_suite as "UT_LOGICAL_SUITE" from dual; + l_ctx := dbms_xmlgen.newcontext(l_type_cursor); + dbms_xmlgen.setNullHandling(l_ctx, dbms_xmlgen.empty_tag); + l_xml := dbms_xmlgen.getxmltype(l_ctx); + select deletexml( - xmltype(l_suite), + l_xml, '//RESULTS_COUNT|//START_TIME|//END_TIME|//RESULT|//ASSOCIATED_EVENT_NAME' || '|//TRANSACTION_INVALIDATORS|//ERROR_BACKTRACE|//ERROR_STACK|//SERVEROUTPUT' ) @@ -638,7 +645,8 @@ create or replace package body test_suite_builder is l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); --Assert ut.expect(l_actual).to_be_like( - '%' || + ''|| + '' || '%' || '%' || '' || @@ -663,7 +671,8 @@ create or replace package body test_suite_builder is '%' || '' || '' || - '' + ''|| + '' ); end; @@ -687,6 +696,7 @@ create or replace package body test_suite_builder is l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); --Assert ut.expect(l_actual).to_be_like( + ''|| '' || '%' || '%' || @@ -707,7 +717,8 @@ create or replace package body test_suite_builder is '%%suite_level_test%' || '%' || '%' || - '%' + '%'|| + '' ); ut.expect(l_actual).not_to_be_like('%%%%%%'); ut.expect(l_actual).not_to_be_like('%%%%%%'); @@ -735,6 +746,7 @@ create or replace package body test_suite_builder is l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); --Assert ut.expect(l_actual).to_be_like( + ''|| '' || '%' || '%' || @@ -757,7 +769,8 @@ create or replace package body test_suite_builder is '%' || '%%suite_level_beforeall%' || '%%suite_level_afterall%' || - '%' + '%'|| + '' ); ut.expect(l_actual).not_to_be_like('%%%%%%'); ut.expect(l_actual).not_to_be_like('%%%%%%'); @@ -784,6 +797,7 @@ create or replace package body test_suite_builder is ,'\' ); ut.expect(l_actual).to_be_like( + ''|| '' || '%' || '' || @@ -799,7 +813,8 @@ create or replace package body test_suite_builder is '%' || '' || ''|| - '' + ''|| + '' ); end; @@ -827,6 +842,7 @@ create or replace package body test_suite_builder is ,'\' ); ut.expect(l_actual).to_be_like( + ''|| '' || '%' || '' || @@ -851,7 +867,8 @@ create or replace package body test_suite_builder is '%' || '' || '' || - '' + ''|| + '' ); end; @@ -884,6 +901,7 @@ create or replace package body test_suite_builder is ,'\' ); ut.expect(l_actual).to_be_like( + ''|| '' || '%' || '' || @@ -908,7 +926,8 @@ create or replace package body test_suite_builder is '%' || '' || '' || - '' + ''|| + '' ); end; From a42e2440c303792e8619e89e1320228d8efa2a60 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Tue, 23 Apr 2019 19:27:16 +0100 Subject: [PATCH 07/23] Adding tests for ut.run Change query to use regexp as instr was giving false positives. --- source/core/ut_suite_manager.pkb | 6 +- test/ut3_tester_helper/run_helper.pkb | 47 +++++++++++ test/ut3_tester_helper/run_helper.pks | 9 +++ test/ut3_user/api/test_ut_run.pkb | 109 ++++++++++++++++++++++++++ test/ut3_user/api/test_ut_run.pks | 34 ++++++++ 5 files changed, 203 insertions(+), 2 deletions(-) diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 54bf8fa04..f85128434 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -370,7 +370,7 @@ create or replace package body ut_suite_manager is l_ut_owner varchar2(250) := ut_utils.ut_owner; l_sql varchar2(32767); l_suite_item_name varchar2(20); - l_tag_list varchar2(4000) :=a_tags; + l_tag_list varchar2(4000) := a_tags; begin if a_path is null and a_object_name is not null then execute immediate 'select min(path) @@ -384,6 +384,8 @@ create or replace package body ut_suite_manager is end if; l_suite_item_name := case when l_tag_list is not null then 'suite_items_tags' else 'suite_items' end; + + /* Rewrite that as tags should be put on whats left not on full suite item cache */ l_sql := q'[with @@ -420,7 +422,7 @@ create or replace package body ut_suite_manager is where exists ( select 1 from ]'||l_ut_owner||q'[.ut_suite_cache_tag ct - where ct.suiteid = s.id and instr(:a_tag_list,ct.tagname) > 0 ) + where ct.suiteid = s.id and regexp_like(:a_tag_list,'(^|,){1}'||ct.tagname||'(,|$){1}') ) ), suite_items_tags as ( select c.* from suite_items c diff --git a/test/ut3_tester_helper/run_helper.pkb b/test/ut3_tester_helper/run_helper.pkb index 0fad905fd..38252f069 100644 --- a/test/ut3_tester_helper/run_helper.pkb +++ b/test/ut3_tester_helper/run_helper.pkb @@ -197,13 +197,16 @@ create or replace package body run_helper is begin execute immediate q'[create or replace package test_package_1 is --%suite + --%tags(suite1,helper) --%suitepath(tests) --%rollback(manual) --%test(Test1 from test package 1) + --%tags(test1,suite1test1,subtest1) procedure test1; --%test(Test2 from test package 1) + --%tags(test1,suite1test1) procedure test2; end test_package_1; @@ -223,12 +226,15 @@ create or replace package body run_helper is execute immediate q'[create or replace package test_package_2 is --%suite + --%tags(suite2,helper) --%suitepath(tests.test_package_1) --%test + --%tags(test2,test1suite2,subtest2) procedure test1; --%test + --%tags(test2suite1) procedure test2; end test_package_2; @@ -247,12 +253,15 @@ create or replace package body run_helper is execute immediate q'[create or replace package test_package_3 is --%suite + --%tags(suite3,helper) --%suitepath(tests2) --%test + --%tags(test1suite3) procedure test1; --%test + --%tags(test2suite3) procedure test2; end test_package_3; @@ -431,6 +440,44 @@ create or replace package body run_helper is )); return l_results; end; + + procedure run(a_reporter ut3.ut_reporter_base := null,a_tags varchar2) is + begin + ut3.ut.run(a_reporter,a_tags => a_tags); + end; + + procedure run(a_path varchar2, a_reporter ut3.ut_reporter_base := null,a_tags varchar2) is + begin + ut3.ut.run(a_path, a_reporter,a_tags => a_tags); + end; + + procedure run(a_paths ut3.ut_varchar2_list, a_reporter ut3.ut_reporter_base := null, a_tags varchar2) is + begin + ut3.ut.run(a_paths, a_reporter,a_tags => a_tags); + end; + + function run(a_reporter ut3.ut_reporter_base := null,a_tags varchar2) return ut3.ut_varchar2_list is + l_results ut3.ut_varchar2_list; + begin + select * bulk collect into l_results from table (ut3.ut.run(a_reporter, a_tags => a_tags)); + return l_results; + end; + + function run(a_path varchar2, a_reporter ut3.ut_reporter_base := null, a_tags varchar2) + return ut3.ut_varchar2_list is + l_results ut3.ut_varchar2_list; + begin + select * bulk collect into l_results from table (ut3.ut.run(a_path, a_reporter,a_tags => a_tags)); + return l_results; + end; + + function run(a_paths ut3.ut_varchar2_list, a_reporter ut3.ut_reporter_base := null, a_tags varchar2) + return ut3.ut_varchar2_list is + l_results ut3.ut_varchar2_list; + begin + select * bulk collect into l_results from table (ut3.ut.run(a_paths, a_reporter, a_tags => a_tags)); + return l_results; + end; procedure test_rollback_type(a_procedure_name varchar2, a_rollback_type integer, a_expectation ut3_latest_release.ut_matcher) is l_suite ut3.ut_suite; diff --git a/test/ut3_tester_helper/run_helper.pks b/test/ut3_tester_helper/run_helper.pks index 7d285d7af..45c64741c 100644 --- a/test/ut3_tester_helper/run_helper.pks +++ b/test/ut3_tester_helper/run_helper.pks @@ -41,6 +41,15 @@ create or replace package run_helper is return ut3.ut_varchar2_list; function run(a_test_files ut3.ut_varchar2_list, a_reporter ut3.ut_reporter_base) return ut3.ut_varchar2_list; + + procedure run(a_reporter ut3.ut_reporter_base := null,a_tags varchar2); + procedure run(a_path varchar2, a_reporter ut3.ut_reporter_base := null,a_tags varchar2); + procedure run(a_paths ut3.ut_varchar2_list, a_reporter ut3.ut_reporter_base := null, a_tags varchar2); + function run(a_reporter ut3.ut_reporter_base := null,a_tags varchar2) return ut3.ut_varchar2_list; + function run(a_path varchar2, a_reporter ut3.ut_reporter_base := null, a_tags varchar2) + return ut3.ut_varchar2_list; + function run(a_paths ut3.ut_varchar2_list, a_reporter ut3.ut_reporter_base := null, a_tags varchar2) + return ut3.ut_varchar2_list; procedure test_rollback_type(a_procedure_name varchar2, a_rollback_type integer, a_expectation ut3_latest_release.ut_matcher); diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb index 43a2238ae..0844b819d 100644 --- a/test/ut3_user/api/test_ut_run.pkb +++ b/test/ut3_user/api/test_ut_run.pkb @@ -787,5 +787,114 @@ Failures:% ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)); end; + procedure test_run_by_one_tag is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'suite1test1'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + + procedure suite_run_by_one_tag is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'suite2'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).not_to_be_like( '%test_package_1.%executed%' ); + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_2%' ); + ut.expect( l_results ).to_be_like( '%test_package_2.%executed%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3.%executed%' ); + end; + + procedure two_test_run_by_one_tag is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'test2'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).not_to_be_like( '%test_package_1.%executed%' ); + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_2%' ); + ut.expect( l_results ).to_be_like( '%test_package_2.%executed%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3.%executed%' ); + end; + + procedure all_suites_run_by_one_tag is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'helper'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_2%' ); + ut.expect( l_results ).to_be_like( '%test_package_3%' ); + end; + + procedure two_test_run_by_two_tags is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'subtest1,subtest2'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_1.test2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_2.test2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + + procedure suite_with_children_tag is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'suite1'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + + procedure test_nonexists_tag is + l_results clob; + l_exp_message varchar2(4000); + begin + l_exp_message :=q'[ORA-20204: No suite packages found for tags: 'nonexisting']'; + ut3_tester_helper.run_helper.run(a_tags => 'nonexisting'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + ut.fail('Expecte test to fail'); + --Assert + exception + when others then + ut.expect( sqlerrm ).to_be_like( l_exp_message ); + end; + + procedure test_duplicate_tag is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'suite1test1,suite1test1'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + + procedure suite_duplicate_tag is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'suite1,suite1'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + end; / diff --git a/test/ut3_user/api/test_ut_run.pks b/test/ut3_user/api/test_ut_run.pks index 82b7eee95..c79686dc6 100644 --- a/test/ut3_user/api/test_ut_run.pks +++ b/test/ut3_user/api/test_ut_run.pks @@ -163,6 +163,40 @@ create or replace package test_ut_run is --%endcontext + --%context(run with tags) + --%displayname(Call ut.run with #tags) + --%beforeall(create_ut3$user#_tests) + --%afterall(drop_ut3$user#_tests) + + --%test(Execute test by tag) + procedure test_run_by_one_tag; + + --%test( Execute suite by one tag) + procedure suite_run_by_one_tag; + + --%test(Execute two tests by one tag) + procedure two_test_run_by_one_tag; + + --%test(Execute all suites tests with tag) + procedure all_suites_run_by_one_tag; + + --%test(Execute tests by passing two tags) + procedure two_test_run_by_two_tags; + + --%test(Execute suite and all of its children) + procedure suite_with_children_tag; + + --%test(Execute test for non existing tag) + procedure test_nonexists_tag; + + --%test(Execute test for duplicate list tags) + procedure test_duplicate_tag; + + --%test(Execute suite test for duplicate list tags) + procedure suite_duplicate_tag; + + --%endcontext + end; / From 5ee864177ae7784860aa4b51e69dc74000ad5b3a Mon Sep 17 00:00:00 2001 From: lwasylow Date: Wed, 24 Apr 2019 19:40:00 +0100 Subject: [PATCH 08/23] Added tests for ut.run procedure --- source/core/ut_suite_manager.pkb | 41 +++++++++++++++----- test/ut3_tester_helper/run_helper.pkb | 2 +- test/ut3_user/api/test_ut_run.pkb | 56 +++++++++++++++++++++++++++ test/ut3_user/api/test_ut_run.pks | 14 ++++++- 4 files changed, 102 insertions(+), 11 deletions(-) diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index f85128434..a770d3d6d 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -17,6 +17,7 @@ create or replace package body ut_suite_manager is */ gc_suitpath_error_message constant varchar2(100) := 'Suitepath exceeds 1000 CHAR on: '; + gc_tag_errmsg constant number := 450; type t_path_item is record ( object_name varchar2(250), @@ -691,6 +692,34 @@ create or replace package body ut_suite_manager is return l_suites; end; + function build_no_test_error_msg( + a_schema_name in varchar2, + a_suite_path in varchar2, + a_procedure_name in varchar2, + a_object_name in varchar2, + a_tags in varchar2 + ) return varchar2 is + l_error_msg varchar2(500); + begin + if a_suite_path is not null then + l_error_msg := 'No suite packages found for path '||a_schema_name||':'||a_suite_path; + elsif a_procedure_name is not null then + l_error_msg := 'Suite test '||a_schema_name||'.'||a_object_name|| '.'||a_procedure_name||' does not exist'; + elsif a_object_name is not null then + l_error_msg := 'Suite package '||a_schema_name||'.'||a_object_name|| ' does not exist'; + end if; + + if l_error_msg is null and a_tags is not null then + l_error_msg := 'No tests found for tags: '||ut_utils.to_string(a_tags,a_max_output_len => gc_tag_errmsg); + elsif l_error_msg is not null and a_tags is not null then + l_error_msg := l_error_msg||'with tags: '||ut_utils.to_string(a_tags,a_max_output_len => gc_tag_errmsg); + end if; + + l_error_msg := l_error_msg ||'.'; + + return l_error_msg; + end; + procedure configure_execution_by_path( a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, @@ -730,15 +759,9 @@ create or replace package body ut_suite_manager is a_tags ); if a_suites.count = l_suites_count then - if l_path_item.suite_path is not null then - raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for path '||l_schema||':'||l_path_item.suite_path|| '.'); - elsif l_path_item.procedure_name is not null then - raise_application_error(ut_utils.gc_suite_package_not_found,'Suite test '||l_schema||'.'||l_path_item.object_name|| '.'||l_path_item.procedure_name||' does not exist'); - elsif l_path_item.object_name is not null then - raise_application_error(ut_utils.gc_suite_package_not_found,'Suite package '||l_schema||'.'||l_path_item.object_name|| ' does not exist'); - elsif a_tags is not null then - raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for tags: '||ut_utils.to_string(a_tags,a_max_output_len => 450)); - end if; + raise_application_error(ut_utils.gc_suite_package_not_found,build_no_test_error_msg( + l_schema,l_path_item.suite_path,l_path_item.procedure_name, + l_path_item.object_name,a_tags)); end if; l_index := a_suites.first; l_suites_count := a_suites.count; diff --git a/test/ut3_tester_helper/run_helper.pkb b/test/ut3_tester_helper/run_helper.pkb index 38252f069..3e31b6ae6 100644 --- a/test/ut3_tester_helper/run_helper.pkb +++ b/test/ut3_tester_helper/run_helper.pkb @@ -206,7 +206,7 @@ create or replace package body run_helper is procedure test1; --%test(Test2 from test package 1) - --%tags(test1,suite1test1) + --%tags(test1,suite1test2) procedure test2; end test_package_1; diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb index 0844b819d..5afc36ad4 100644 --- a/test/ut3_user/api/test_ut_run.pkb +++ b/test/ut3_user/api/test_ut_run.pkb @@ -895,6 +895,62 @@ Failures:% ut.expect( l_results ).to_be_like( '%test_package_2%' ); ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); end; + + procedure run_proc_pkg_name_no_tag is + l_results clob; + l_exp_message varchar2(4000); + begin + l_exp_message :=q'[ORA-20204: Suite package ut3_tester_helper.test_package_1 does not existwith tags: 'nonexists'.]'; + ut3.ut.run('ut3_tester_helper.test_package_1',a_tags => 'nonexists'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + ut.fail('Expecte test to fail'); + exception + when others then + ut.expect( sqlerrm ).to_be_like( l_exp_message ); + end; + + procedure run_proc_pkg_name_tag is + l_results clob; + begin + ut3.ut.run('ut3_tester_helper.test_package_1',a_tags => 'suite1test1'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_1.test1%executed%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_1.test2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + + procedure run_pkg_name_file_list_tag is + l_results clob; + begin + ut3.ut.run('ut3_tester_helper.test_package_1',a_tags => 'suite1test1'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_1.test1%executed%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_1.test2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + + procedure run_proc_path_list_tag is + l_results clob; + begin + ut3.ut.run( + 'ut3_tester_helper.test_package_1', + ut3.ut_sonar_test_reporter(), a_source_files => ut3.ut_varchar2_list(),a_tags => 'suite1', + a_test_files => ut3.ut_varchar2_list('tests/ut3_tester_helper.test_package_1.pkb', + 'tests/ut3_tester_helper.test_package_2.pkb', + 'tests/ut3_tester_helper.test_package_3.pkb') + ); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%tests/ut3_tester_helper.test_package_1.pkb%' ); + ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%' ); + ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_3.pkb%' ); + end; end; / diff --git a/test/ut3_user/api/test_ut_run.pks b/test/ut3_user/api/test_ut_run.pks index c79686dc6..872a2a05b 100644 --- a/test/ut3_user/api/test_ut_run.pks +++ b/test/ut3_user/api/test_ut_run.pks @@ -168,7 +168,7 @@ create or replace package test_ut_run is --%beforeall(create_ut3$user#_tests) --%afterall(drop_ut3$user#_tests) - --%test(Execute test by tag) + --%test(Execute test by tag ut_run) procedure test_run_by_one_tag; --%test( Execute suite by one tag) @@ -194,6 +194,18 @@ create or replace package test_ut_run is --%test(Execute suite test for duplicate list tags) procedure suite_duplicate_tag; + + --%test(Run a package by name with non existing tag) + procedure run_proc_pkg_name_no_tag; + + --%test(Runs given package only with package name given as path and filter by tag) + procedure run_proc_pkg_name_tag; + + --%test(Runs all from given package with package name given as path and coverage file list with tag) + procedure run_pkg_name_file_list_tag; + + --%test(Runs tests from given paths with paths list and tag) + procedure run_proc_path_list_tag; --%endcontext From 176519c69090cadc2721950a95106bc079bd5868 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Wed, 24 Apr 2019 19:51:28 +0100 Subject: [PATCH 09/23] Added extra tests for ut run function --- test/ut3_tester_helper/run_helper.pkb | 4 ++-- test/ut3_user/api/test_ut_run.pkb | 33 +++++++++++++++++++++++++++ test/ut3_user/api/test_ut_run.pks | 9 ++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/test/ut3_tester_helper/run_helper.pkb b/test/ut3_tester_helper/run_helper.pkb index 3e31b6ae6..45403ca8a 100644 --- a/test/ut3_tester_helper/run_helper.pkb +++ b/test/ut3_tester_helper/run_helper.pkb @@ -230,11 +230,11 @@ create or replace package body run_helper is --%suitepath(tests.test_package_1) --%test - --%tags(test2,test1suite2,subtest2) + --%tags(test2,suite2test1,subtest2) procedure test1; --%test - --%tags(test2suite1) + --%tags(suite2test2) procedure test2; end test_package_2; diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb index 5afc36ad4..4dc5e41c6 100644 --- a/test/ut3_user/api/test_ut_run.pkb +++ b/test/ut3_user/api/test_ut_run.pkb @@ -951,6 +951,39 @@ Failures:% ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_2.pkb%' ); ut.expect( l_results ).not_to_be_like( '%tests/ut3_tester_helper.test_package_3.pkb%' ); end; + + procedure tag_run_func_no_params is + l_results ut3.ut_varchar2_list; + begin + l_results := ut3_tester_helper.run_helper.run(a_tags => 'helper'); + --Assert + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%test_package_2%test_package_3%' ); + end; + + procedure tag_run_func_pkg_name is + l_results ut3.ut_varchar2_list; + begin + select * bulk collect into l_results from table (ut3.ut.run('ut3_tester_helper.test_package_1', a_tags => 'suite1test1')); + --Assert + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' ); + end; + + procedure tag_run_func_path_list is + l_results ut3.ut_varchar2_list; + begin + l_results := ut3_tester_helper.run_helper.run(ut3.ut_varchar2_list(':tests.test_package_1',':tests'),a_tags => 'suite1test1,suite2test1'); + --Assert + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_1.test1%executed%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_1.test2%executed%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%test_package_2.test1%executed%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_2.test2%executed%' ); + ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%test_package_3%' ); + end; end; / diff --git a/test/ut3_user/api/test_ut_run.pks b/test/ut3_user/api/test_ut_run.pks index 872a2a05b..feb825ffa 100644 --- a/test/ut3_user/api/test_ut_run.pks +++ b/test/ut3_user/api/test_ut_run.pks @@ -207,6 +207,15 @@ create or replace package test_ut_run is --%test(Runs tests from given paths with paths list and tag) procedure run_proc_path_list_tag; + --%test(Runs all tests in current schema with default reporter when only tag is given) + procedure tag_run_func_no_params; + + --%test(Runs given package only with package name given as path and filter by tag) + procedure tag_run_func_pkg_name; + + --%test(Runs tests from given paths with paths list and a tag) + procedure tag_run_func_path_list; + --%endcontext end; From b1f4a625eba580952acf746e4794bde8dca38c1f Mon Sep 17 00:00:00 2001 From: lwasylow Date: Wed, 24 Apr 2019 19:57:34 +0100 Subject: [PATCH 10/23] Fixing error message function --- source/core/ut_suite_manager.pkb | 6 +++--- test/ut3_user/api/test_ut_run.pkb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index a770d3d6d..20c017091 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -704,15 +704,15 @@ create or replace package body ut_suite_manager is if a_suite_path is not null then l_error_msg := 'No suite packages found for path '||a_schema_name||':'||a_suite_path; elsif a_procedure_name is not null then - l_error_msg := 'Suite test '||a_schema_name||'.'||a_object_name|| '.'||a_procedure_name||' does not exist'; + l_error_msg := 'Suite test '||a_schema_name||'.'||a_object_name|| '.'||a_procedure_name||' does not exists'; elsif a_object_name is not null then - l_error_msg := 'Suite package '||a_schema_name||'.'||a_object_name|| ' does not exist'; + l_error_msg := 'Suite package '||a_schema_name||'.'||a_object_name|| ' does not exists'; end if; if l_error_msg is null and a_tags is not null then l_error_msg := 'No tests found for tags: '||ut_utils.to_string(a_tags,a_max_output_len => gc_tag_errmsg); elsif l_error_msg is not null and a_tags is not null then - l_error_msg := l_error_msg||'with tags: '||ut_utils.to_string(a_tags,a_max_output_len => gc_tag_errmsg); + l_error_msg := l_error_msg||' with tags: '||ut_utils.to_string(a_tags,a_max_output_len => gc_tag_errmsg); end if; l_error_msg := l_error_msg ||'.'; diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb index 4dc5e41c6..0b0598ad5 100644 --- a/test/ut3_user/api/test_ut_run.pkb +++ b/test/ut3_user/api/test_ut_run.pkb @@ -864,7 +864,7 @@ Failures:% l_results clob; l_exp_message varchar2(4000); begin - l_exp_message :=q'[ORA-20204: No suite packages found for tags: 'nonexisting']'; + l_exp_message :=q'[ORA-20204: No tests found for tags: 'nonexisting'.]'; ut3_tester_helper.run_helper.run(a_tags => 'nonexisting'); l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); ut.fail('Expecte test to fail'); @@ -900,7 +900,7 @@ Failures:% l_results clob; l_exp_message varchar2(4000); begin - l_exp_message :=q'[ORA-20204: Suite package ut3_tester_helper.test_package_1 does not existwith tags: 'nonexists'.]'; + l_exp_message :=q'[ORA-20204: Suite package ut3_tester_helper.test_package_1 does not exists with tags: 'nonexists'.]'; ut3.ut.run('ut3_tester_helper.test_package_1',a_tags => 'nonexists'); l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); ut.fail('Expecte test to fail'); From dbbf197914e371bacbc812a1837554cf2a01c75a Mon Sep 17 00:00:00 2001 From: lwasylow Date: Wed, 24 Apr 2019 20:32:21 +0100 Subject: [PATCH 11/23] Update docs --- docs/userguide/annotations.md | 77 +++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/docs/userguide/annotations.md b/docs/userguide/annotations.md index 2ffaf169b..ae99ea363 100644 --- a/docs/userguide/annotations.md +++ b/docs/userguide/annotations.md @@ -38,6 +38,7 @@ We strongly recommend putting package level annotations at the very top of packa | `--%disabled` | Package/procedure | Used to disable a suite or a test. Disabled suites/tests do not get executed, they are however marked and reported as disabled in a test run. | | `--%context()` | Package | Denotes start of a named context (sub-suite) in a suite package | | `--%endcontext` | Package | Denotes end of a nested context (sub-suite) in a suite package | +| `--%tags` | Package/procedure | Used to label a test or a suite for purpose of identification | ### Suite @@ -823,7 +824,7 @@ See [beforeall](#Beforeall) for more examples. Indicates specific setup procedure(s) to be executed for a test. The procedure(s) can be located either: - within current package (package name is optional) - within another package - + The annotation need to be placed alongside `--%test` annotation. The `--%beforetest` procedures are executed after invoking all `--%beforeeach` for a test. @@ -911,7 +912,7 @@ Finished in .015185 seconds Indicates specific cleanup procedure(s) to be executed for a test. The procedure(s) can be located either: - within current package (package name is optional) - within another package - + The annotation need to be placed alongside `--%test` annotation. If a test is marked as disabled the `--%aftertest` procedures are not invoked for that test. @@ -1221,6 +1222,74 @@ Finished in .035261 seconds ``` + +### Tags + +Tag is a label attached to the test or a suite path. It is used for identification and execution a group of tests / suites that share same tag. + +It allows us to group a tests / suites using a various categorization and place a test / suite in multiple buckets. Same tests can be group with other tests based on the functionality , frequency, type of output etc. + +e.q. + +```sql +--%tags(batch,daily,csv) +``` + +or + +```sql +--%tags(api,online,json) +``` + + + +Tags are defined as a coma separated list. When executing a tests filtering by tag utPLSQL will find all tests associated with a given tag and execute it. It will apply `OR` logic when resolving a tags so any tests / suites that got matching at least one tag will get executed. + +When a suite gets tagged all of its children will automatically inherit a tag and get executed along the parent. + +```sql +create or replace PACKAGE ut_sample_test IS + + --%suite(Sample Test Suite) + --%tag(suite1) + + --%test(Compare Ref Cursors) + --%tag(test1,sample) + PROCEDURE ut_refcursors1; + +END ut_sample_test; +/ + +create or replace PACKAGE BODY ut_sample_test IS + + PROCEDURE ut_refcursors1 IS + v_actual SYS_REFCURSOR; + v_expected SYS_REFCURSOR; + BEGIN + open v_expected for select 1 as test from dual; + open v_actual for select 2 as test from dual; + + ut.expect(v_actual).to_equal(v_expected); + END; + +END ut_sample_test; +/ +``` + +Execution of the test is done by using a new parameter `a_tags` + +```sql +select * from table(ut.run(a_path => 'ut_sample_test',a_tags => 'suite1')); +select * from table(ut.run(a_tags => 'suite1')); + +begin + ut.run(a_path => 'ut_sample_test',a_tags => 'suite1'); +end; +/ +``` + + + ### Suitepath It is very likely that the application for which you are going to introduce tests consists of many different packages, procedures and functions. @@ -1346,9 +1415,9 @@ If `--%throws` annotation is specified with arguments and exception raised is no The framework will raise a warning, when `--%throws` annotation has invalid arguments or when no arguments were provided. Annotation `--%throws(7894562, operaqk, -=1, -20496, pow74d, posdfk3)` will be interpreted as `--%throws(-20496)`. - + Please note that `NO_DATA_FOUND` exception is a special case in Oracle. To capture it use `NO_DATA_FOUND` named exception or `-1403` exception No. - +​ Example: ```sql create or replace package exc_pkg is From f7144991a19057e0924ac86f86c49ff028f42bff Mon Sep 17 00:00:00 2001 From: lwasylow Date: Wed, 24 Apr 2019 20:38:43 +0100 Subject: [PATCH 12/23] Update docs and tests --- docs/userguide/annotations.md | 21 +++++++++++++++++++-- test/ut3_user/api/test_ut_run.pkb | 11 +++++++++++ test/ut3_user/api/test_ut_run.pks | 5 ++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/userguide/annotations.md b/docs/userguide/annotations.md index ae99ea363..946ad12ea 100644 --- a/docs/userguide/annotations.md +++ b/docs/userguide/annotations.md @@ -1245,7 +1245,9 @@ or Tags are defined as a coma separated list. When executing a tests filtering by tag utPLSQL will find all tests associated with a given tag and execute it. It will apply `OR` logic when resolving a tags so any tests / suites that got matching at least one tag will get executed. -When a suite gets tagged all of its children will automatically inherit a tag and get executed along the parent. +When a suite gets tagged all of its children will automatically inherit a tag and get executed along the parent. Parent suit tests are not executed. but a suitepath hierarchy is kept. + +Sample tag package. ```sql create or replace PACKAGE ut_sample_test IS @@ -1257,6 +1259,10 @@ create or replace PACKAGE ut_sample_test IS --%tag(test1,sample) PROCEDURE ut_refcursors1; + --%test(Compare Ref Cursors #2) + --%tag(test2,sample) + PROCEDURE ut_refcursors2; + END ut_sample_test; / @@ -1271,7 +1277,17 @@ create or replace PACKAGE BODY ut_sample_test IS ut.expect(v_actual).to_equal(v_expected); END; + + PROCEDURE ut_refcursors2 IS + v_actual SYS_REFCURSOR; + v_expected SYS_REFCURSOR; + BEGIN + open v_expected for select 1 as test from dual; + open v_actual for select 2 as test from dual; + ut.expect(v_actual).to_equal(v_expected); + END; + END ut_sample_test; / ``` @@ -1280,7 +1296,8 @@ Execution of the test is done by using a new parameter `a_tags` ```sql select * from table(ut.run(a_path => 'ut_sample_test',a_tags => 'suite1')); -select * from table(ut.run(a_tags => 'suite1')); +select * from table(ut.run(a_tags => 'test1,test2')); +select * from table(ut.run(a_tags => 'sample')); begin ut.run(a_path => 'ut_sample_test',a_tags => 'suite1'); diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb index 0b0598ad5..60c9a7dc8 100644 --- a/test/ut3_user/api/test_ut_run.pkb +++ b/test/ut3_user/api/test_ut_run.pkb @@ -860,6 +860,17 @@ Failures:% ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); end; + procedure suite_with_tag_parent is + l_results clob; + begin + ut3_tester_helper.run_helper.run(a_tags => 'suite2'); + l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); + --Assert + ut.expect( l_results ).to_be_like( '%test_package_1%' ); + ut.expect( l_results ).to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); + end; + procedure test_nonexists_tag is l_results clob; l_exp_message varchar2(4000); diff --git a/test/ut3_user/api/test_ut_run.pks b/test/ut3_user/api/test_ut_run.pks index feb825ffa..fcb62e207 100644 --- a/test/ut3_user/api/test_ut_run.pks +++ b/test/ut3_user/api/test_ut_run.pks @@ -186,6 +186,9 @@ create or replace package test_ut_run is --%test(Execute suite and all of its children) procedure suite_with_children_tag; + --%test(Execute suite and parents) + procedure suite_with_tag_parent; + --%test(Execute test for non existing tag) procedure test_nonexists_tag; @@ -215,7 +218,7 @@ create or replace package test_ut_run is --%test(Runs tests from given paths with paths list and a tag) procedure tag_run_func_path_list; - + --%endcontext end; From e5754040bb47bcc26ba4aa754cfb83994ebfc273 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Thu, 25 Apr 2019 05:43:45 +0100 Subject: [PATCH 13/23] Fixes to PR comments --- source/core/ut_suite_builder.pkb | 7 ++++--- source/core/ut_suite_manager.pkb | 24 ++++++++---------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index ab4920e9c..dcbfedf27 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -320,7 +320,7 @@ create or replace package body ut_suite_builder is while l_annotation_pos is not null loop if a_tags_ann_text(l_annotation_pos) is null then a_suite.put_warning( - '"--%tag" annotation requires a tag value populated. Annotation ignored.' + '"--%tags" annotation requires a tag value populated. Annotation ignored.' || chr( 10 ) || 'at "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || l_annotation_pos ); else @@ -328,6 +328,7 @@ create or replace package body ut_suite_builder is ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos),',') ); end if; + --remove empty strings from table list e.g. tag1,,tag2 a_list := ut_utils.table_to_clob( ut_utils.filter_list(l_tag_list,'^(\w|\S)+$'), ','); @@ -632,7 +633,7 @@ create or replace package body ut_suite_builder is while l_annotation_pos is not null loop if a_tags_ann_text(l_annotation_pos) is null then a_suite.put_warning( - '"--%tag" annotation requires a tag value populated. Annotation ignored, line ' || l_annotation_pos + '"--%tags" annotation requires a tag value populated. Annotation ignored, line ' || l_annotation_pos ); else l_tag_list := l_tag_list multiset union distinct ut_utils.trim_list_elements( @@ -641,6 +642,7 @@ create or replace package body ut_suite_builder is end if; l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; + --remove empty strings from table list e.g. tag1,,tag2 a_suite.tags := ut_utils.table_to_clob( ut_utils.filter_list(l_tag_list,'^(\w|\S)+$'), ','); @@ -657,7 +659,6 @@ create or replace package body ut_suite_builder is l_after_all_list tt_executables; l_rollback_type ut_utils.t_rollback_type; l_annotation_text t_annotation_text; - l_suite_tags ut_varchar2_rows; begin if a_annotations.by_name.exists(gc_displayname) then l_annotation_text := trim(a_annotations.by_name(gc_displayname)(a_annotations.by_name(gc_displayname).first)); diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 20c017091..3d34f34e9 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -194,7 +194,7 @@ create or replace package body ut_suite_manager is 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), tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags ) else ut_suite( @@ -207,7 +207,7 @@ create or replace package body ut_suite_manager is 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), tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags ) end; when 'UT_SUITE_CONTEXT' then @@ -223,7 +223,7 @@ create or replace package body ut_suite_manager is 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), tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags ) else ut_suite_context( @@ -236,7 +236,7 @@ create or replace package body ut_suite_manager is 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), tags => a_rows(a_idx).tags --TODO : Should be share or separate + a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags ) end; when 'UT_LOGICAL_SUITE' then @@ -371,7 +371,6 @@ create or replace package body ut_suite_manager is l_ut_owner varchar2(250) := ut_utils.ut_owner; l_sql varchar2(32767); l_suite_item_name varchar2(20); - l_tag_list varchar2(4000) := a_tags; begin if a_path is null and a_object_name is not null then execute immediate 'select min(path) @@ -383,11 +382,8 @@ create or replace package body ut_suite_manager is else l_path := lower( a_path ); end if; - l_suite_item_name := case when l_tag_list is not null then 'suite_items_tags' else 'suite_items' end; + l_suite_item_name := case when a_tags is not null then 'suite_items_tags' else 'suite_items' end; - - - /* Rewrite that as tags should be put on whats left not on full suite item cache */ l_sql := q'[with suite_items as ( @@ -417,7 +413,7 @@ create or replace package body ut_suite_manager is ) ) ),]' - ||case when l_tag_list is not null then + ||case when a_tags is not null then q'[ filter_tags as ( select s.* from suite_items s where exists @@ -501,7 +497,7 @@ create or replace package body ut_suite_manager is c.path, :a_random_seed ) desc nulls last' end; - open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tag_list, a_random_seed; + open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), a_tags, a_random_seed; return l_result; end; @@ -739,11 +735,7 @@ create or replace package body ut_suite_manager is resolve_schema_names(l_paths); l_schema_paths := group_paths_by_schema(l_paths); - - -- TODO : use a_tags to filter out path. Should we do it before ? we dont know suites, if we do it after - -- we running into danger of filtering out to null value and raising wrong message. I reckon we should resolve that - -- before loop and l_th_items is set or after filter it out. - + l_schema := l_schema_paths.first; while l_schema is not null loop l_path_items := l_schema_paths(l_schema); From 632b64dec324faa63b2e260c3973bf6ffda25021 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Thu, 25 Apr 2019 05:57:35 +0100 Subject: [PATCH 14/23] Fixes to PR comments --- test/ut3_tester/core/test_suite_builder.pkb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index d6f1a8b66..49b54fa61 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -1284,7 +1284,7 @@ create or replace package body test_suite_builder is l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); --Assert ut.expect(l_actual).to_be_like( - '%%"--%tag" annotation requires a tag value populated. Annotation ignored.%%'|| + '%%"--%tags" annotation requires a tag value populated. Annotation ignored.%%'|| '%%' ); @@ -1303,7 +1303,7 @@ create or replace package body test_suite_builder is l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); --Assert ut.expect(l_actual).to_be_like( - '%"--%tag" annotation requires a tag value populated. Annotation ignored, line 3%'|| + '%"--%tags" annotation requires a tag value populated. Annotation ignored, line 3%'|| '%%' ); From 66257d18701461048b8665c08f25e091e0ff2601 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Thu, 25 Apr 2019 06:41:48 +0100 Subject: [PATCH 15/23] Updates to PR --- source/core/types/ut_suite.tps | 4 ---- source/core/types/ut_suite_item.tps | 4 ++++ source/core/types/ut_test.tps | 4 ---- source/core/ut_suite_manager.pkb | 4 ++-- test/ut3_tester/core/test_suite_builder.pkb | 7 ------- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/source/core/types/ut_suite.tps b/source/core/types/ut_suite.tps index 0bcddd59b..a9647dcf3 100644 --- a/source/core/types/ut_suite.tps +++ b/source/core/types/ut_suite.tps @@ -26,10 +26,6 @@ create or replace type ut_suite under ut_logical_suite ( * Procedure exists within the package of the suite */ after_all_list ut_executables, - /** - * Hold list of tags assign to suite - */ - tags varchar2(4000), constructor function ut_suite ( self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, a_tags varchar2 := null diff --git a/source/core/types/ut_suite_item.tps b/source/core/types/ut_suite_item.tps index 6b3b9c686..f0ea25187 100644 --- a/source/core/types/ut_suite_item.tps +++ b/source/core/types/ut_suite_item.tps @@ -60,6 +60,10 @@ create or replace type ut_suite_item force under ut_event_item ( warnings ut_varchar2_rows, results_count ut_results_counter, transaction_invalidators ut_varchar2_list, + /** + * Hold list of tags assign to test + */ + tags varchar2(4000), member procedure init(self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_line_no integer), member function get_disabled_flag return boolean, not instantiable member procedure mark_as_skipped(self in out nocopy ut_suite_item), diff --git a/source/core/types/ut_test.tps b/source/core/types/ut_test.tps index 23116119c..04d8f321d 100644 --- a/source/core/types/ut_test.tps +++ b/source/core/types/ut_test.tps @@ -55,10 +55,6 @@ create or replace type ut_test force under ut_suite_item ( *Holds the expected error codes list when the user use the annotation throws */ expected_error_codes ut_integer_list, - /** - * Hold list of tags assign to test - */ - tags 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_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags varchar2 := null diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 3d34f34e9..454e4c253 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -250,7 +250,7 @@ create or replace package body ut_suite_manager is 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) + items => a_items_at_level(a_prev_level), tags => null ) else ut_logical_suite( @@ -261,7 +261,7 @@ create or replace package body ut_suite_manager is 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() + items => ut_suite_items(), tags => null ) end; when 'UT_TEST' then diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 49b54fa61..5a9f74992 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -660,7 +660,6 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -670,7 +669,6 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || - '' || ''|| '' ); @@ -812,7 +810,6 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - ''|| ''|| '' ); @@ -856,7 +853,6 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -866,7 +862,6 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || - '' || ''|| '' ); @@ -915,7 +910,6 @@ create or replace package body test_suite_builder is '%some_packagecontext_setup' || '%' || '' || - '' || '' || '' || '%suite_level_testIn suitesome_package.suite_level_test' || @@ -925,7 +919,6 @@ create or replace package body test_suite_builder is '%some_packagesuite_level_beforeall' || '%' || '' || - '' || ''|| '' ); From ddf3a7f608038ef177f76bbf8ee2d4492660e41f Mon Sep 17 00:00:00 2001 From: lwasylow Date: Fri, 26 Apr 2019 06:42:37 +0100 Subject: [PATCH 16/23] Phase 2 : switch to varchar_rows() --- source/api/ut_runner.pkb | 12 +++++-- source/api/ut_suite_item_info.tps | 3 +- source/core/types/ut_run.tpb | 2 +- source/core/types/ut_run.tps | 4 +-- source/core/types/ut_suite.tpb | 4 +-- source/core/types/ut_suite.tps | 2 +- source/core/types/ut_suite_item.tps | 2 +- source/core/types/ut_test.tpb | 4 +-- source/core/types/ut_test.tps | 2 +- source/core/ut_suite_builder.pkb | 12 +++---- source/core/ut_suite_cache.sql | 1 + source/core/ut_suite_cache_manager.pkb | 13 ------- source/core/ut_suite_cache_tag.sql | 7 ---- source/core/ut_suite_manager.pkb | 35 ++++++++++--------- source/core/ut_suite_manager.pks | 2 +- .../create_synonyms_and_grants_for_public.sql | 1 - source/create_user_grants.sql | 1 - source/install.sql | 1 - source/uninstall_objects.sql | 2 -- test/ut3_tester/core/test_suite_builder.pkb | 24 ++++++------- 20 files changed, 57 insertions(+), 77 deletions(-) delete mode 100644 source/core/ut_suite_cache_tag.sql diff --git a/source/api/ut_runner.pkb b/source/api/ut_runner.pkb index 30cdf2691..5a9cc856a 100644 --- a/source/api/ut_runner.pkb +++ b/source/api/ut_runner.pkb @@ -99,6 +99,7 @@ create or replace package body ut_runner is l_include_object_names ut_object_names; l_paths ut_varchar2_list := ut_varchar2_list(); l_random_test_order_seed positive; + l_tags ut_varchar2_rows := ut_varchar2_rows(); begin ut_event_manager.initialize(); if a_reporters is not empty then @@ -139,7 +140,12 @@ create or replace package body ut_runner is if a_exclude_objects is not empty then l_exclude_object_names := to_ut_object_list(a_exclude_objects, l_coverage_schema_names); end if; - + + if a_tags is not null then + l_tags := l_tags multiset union distinct ut_utils.convert_collection( + ut_utils.filter_list(ut_utils.string_to_table(a_tags,','),'^(\w|\S)+$') + ); + end if; l_exclude_object_names := l_exclude_object_names multiset union all ut_suite_manager.get_schema_ut_packages(l_coverage_schema_names); l_include_object_names := to_ut_object_list(a_include_objects, l_coverage_schema_names); @@ -154,10 +160,10 @@ create or replace package body ut_runner is set(a_test_file_mappings), a_client_character_set, l_random_test_order_seed, - a_tags + l_tags ); - ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, a_tags); + ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, l_tags); if a_force_manual_rollback then l_run.set_rollback_type( a_rollback_type => ut_utils.gc_rollback_manual, a_force => true ); end if; diff --git a/source/api/ut_suite_item_info.tps b/source/api/ut_suite_item_info.tps index bf6fd6ecf..b0c77acb6 100644 --- a/source/api/ut_suite_item_info.tps +++ b/source/api/ut_suite_item_info.tps @@ -22,6 +22,7 @@ create or replace type ut_suite_item_info as object ( item_type varchar2( 250 ), -- the type of item (UT_SUITE/UT_SUITE_CONTEXT/UT_TEST) item_line_no integer, -- line_number where annotation identifying the item exists path varchar2( 4000 ),-- suitepath of the item - disabled_flag integer -- 0 (zero) if item is not disabled, 1 if item is disabled by --%disabled annotation + disabled_flag integer, -- 0 (zero) if item is not disabled, 1 if item is disabled by --%disabled annotation + tags varchar2(4000) ) / diff --git a/source/core/types/ut_run.tpb b/source/core/types/ut_run.tpb index d26c6fcb4..c8f2778ff 100644 --- a/source/core/types/ut_run.tpb +++ b/source/core/types/ut_run.tpb @@ -27,7 +27,7 @@ create or replace type body ut_run as a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, a_random_test_order_seed positive := null, - a_run_tags varchar2 := null + a_run_tags ut_varchar2_rows := null ) return self as result is begin self.run_paths := a_run_paths; diff --git a/source/core/types/ut_run.tps b/source/core/types/ut_run.tps index 7ea5cc605..b5a1d18ac 100644 --- a/source/core/types/ut_run.tps +++ b/source/core/types/ut_run.tps @@ -21,7 +21,7 @@ create or replace type ut_run under ut_suite_item ( project_name varchar2(4000), items ut_suite_items, run_paths ut_varchar2_list, - run_tags varchar2(4000), + run_tags ut_varchar2_rows, coverage_options ut_coverage_options, test_file_mappings ut_file_mappings, client_character_set varchar2(100), @@ -37,7 +37,7 @@ create or replace type ut_run under ut_suite_item ( a_test_file_mappings ut_file_mappings := null, a_client_character_set varchar2 := null, a_random_test_order_seed positive := null, - a_run_tags varchar2 := null + a_run_tags ut_varchar2_rows := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_run), overriding member function do_execute(self in out nocopy ut_run) return boolean, diff --git a/source/core/types/ut_suite.tpb b/source/core/types/ut_suite.tpb index bd35d18ca..1211d5d5c 100644 --- a/source/core/types/ut_suite.tpb +++ b/source/core/types/ut_suite.tpb @@ -18,7 +18,7 @@ create or replace type body ut_suite as constructor function ut_suite ( self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, - a_tags varchar2 := null + a_tags ut_varchar2_rows := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -26,7 +26,7 @@ create or replace type body ut_suite as self.items := ut_suite_items(); before_all_list := ut_executables(); after_all_list := ut_executables(); - self.tags := a_tags; + self.tags := coalesce(a_tags,ut_varchar2_rows()); return; end; diff --git a/source/core/types/ut_suite.tps b/source/core/types/ut_suite.tps index a9647dcf3..dd44a817e 100644 --- a/source/core/types/ut_suite.tps +++ b/source/core/types/ut_suite.tps @@ -28,7 +28,7 @@ create or replace type ut_suite under ut_logical_suite ( after_all_list ut_executables, constructor function ut_suite ( self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer, - a_tags varchar2 := null + a_tags ut_varchar2_rows := null ) return self as result, overriding member function do_execute(self in out nocopy ut_suite) return boolean, overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list, diff --git a/source/core/types/ut_suite_item.tps b/source/core/types/ut_suite_item.tps index f0ea25187..a5eb10986 100644 --- a/source/core/types/ut_suite_item.tps +++ b/source/core/types/ut_suite_item.tps @@ -63,7 +63,7 @@ create or replace type ut_suite_item force under ut_event_item ( /** * Hold list of tags assign to test */ - tags varchar2(4000), + tags ut_varchar2_rows, member procedure init(self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_line_no integer), member function get_disabled_flag return boolean, not instantiable member procedure mark_as_skipped(self in out nocopy ut_suite_item), diff --git a/source/core/types/ut_test.tpb b/source/core/types/ut_test.tpb index c1d847bf5..b3b41b4c2 100644 --- a/source/core/types/ut_test.tpb +++ b/source/core/types/ut_test.tpb @@ -18,7 +18,7 @@ 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_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags varchar2 := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags ut_varchar2_rows := null ) return self as result is begin self.self_type := $$plsql_unit; @@ -31,7 +31,7 @@ create or replace type body ut_test as self.all_expectations := ut_expectation_results(); self.failed_expectations := ut_expectation_results(); self.expected_error_codes := a_expected_error_codes; - self.tags := a_tags; + self.tags := coalesce(a_tags,ut_varchar2_rows()); return; end; diff --git a/source/core/types/ut_test.tps b/source/core/types/ut_test.tps index 04d8f321d..ef30ab763 100644 --- a/source/core/types/ut_test.tps +++ b/source/core/types/ut_test.tps @@ -57,7 +57,7 @@ create or replace type ut_test force under ut_suite_item ( expected_error_codes ut_integer_list, constructor function ut_test( self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2, - a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags varchar2 := null + a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags ut_varchar2_rows := null ) return self as result, overriding member procedure mark_as_skipped(self in out nocopy ut_test), overriding member function do_execute(self in out nocopy ut_test) return boolean, diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index dcbfedf27..245a49b76 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -309,7 +309,7 @@ create or replace package body ut_suite_builder is procedure add_tags_to_test( a_suite in out nocopy ut_suite, - a_list in out nocopy varchar2, + a_list in out nocopy ut_varchar2_rows, a_procedure_name t_object_name, a_tags_ann_text tt_annotation_texts ) is @@ -328,10 +328,8 @@ create or replace package body ut_suite_builder is ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos),',') ); end if; - --remove empty strings from table list e.g. tag1,,tag2 - a_list := ut_utils.table_to_clob( - ut_utils.filter_list(l_tag_list,'^(\w|\S)+$'), - ','); + --remove empty strings from table list e.g. tag1,,tag2 and conver to rows + a_list := ut_utils.convert_collection( ut_utils.filter_list(l_tag_list,'^(\w|\S)+$') ); l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; @@ -643,9 +641,7 @@ create or replace package body ut_suite_builder is l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; --remove empty strings from table list e.g. tag1,,tag2 - a_suite.tags := ut_utils.table_to_clob( - ut_utils.filter_list(l_tag_list,'^(\w|\S)+$'), - ','); + a_suite.tags := ut_utils.convert_collection(ut_utils.filter_list(l_tag_list,'^(\w|\S)+$')); end; procedure add_suite_tests( diff --git a/source/core/ut_suite_cache.sql b/source/core/ut_suite_cache.sql index 3a38ceeb7..8687858a3 100644 --- a/source/core/ut_suite_cache.sql +++ b/source/core/ut_suite_cache.sql @@ -47,6 +47,7 @@ create table ut_suite_cache ( nested table before_test_list store as ut_suite_cache_before_test nested table after_test_list store as ut_suite_cache_after_test nested table expected_error_codes store as ut_suite_cache_throws + nested table tags store as ut_suite_cache_tags return as locator as select cast(null as number(22)) id, diff --git a/source/core/ut_suite_cache_manager.pkb b/source/core/ut_suite_cache_manager.pkb index 526a03338..b805919fc 100644 --- a/source/core/ut_suite_cache_manager.pkb +++ b/source/core/ut_suite_cache_manager.pkb @@ -134,19 +134,6 @@ create or replace package body ut_suite_cache_manager is s.t.item as item from tests s; - --TODO : Optimize to use only inserted - merge into ut_suite_cache_tag tgt - using ( select /*+cardinality (tt 100) */ t.id,tt.column_value tag - from ut_suite_cache t, - table(ut_utils.convert_collection((ut_utils.string_to_table(t.tags,',')))) tt - where tt.column_value is not null ) src - on ( tgt.suiteid = src.id and tgt.tagname = src.tag) - when not matched then - insert - (suiteid, tagname ) - values - (src.id, src.tag); - end if; end if; commit; diff --git a/source/core/ut_suite_cache_tag.sql b/source/core/ut_suite_cache_tag.sql deleted file mode 100644 index 17d287dd8..000000000 --- a/source/core/ut_suite_cache_tag.sql +++ /dev/null @@ -1,7 +0,0 @@ -create table ut_suite_cache_tag ( - suiteid number(22) not null, - tagname varchar2(100) not null, - constraint ut_suite_to_tag_pk primary key (suiteid,tagname), - constraint ut_suite_id_fk foreign key ( suiteid ) references ut_suite_cache(id) on delete cascade -) -organization index; \ No newline at end of file diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 454e4c253..768c0af6f 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -299,7 +299,6 @@ create or replace package body ut_suite_manager is begin loop fetch a_suite_data_cursor bulk collect into l_rows limit c_bulk_limit; - l_idx := l_rows.first; while l_idx is not null loop l_level := length(l_rows(l_idx).path) - length( replace(l_rows(l_idx).path, '.') ) + 1; @@ -364,13 +363,14 @@ create or replace package body ut_suite_manager is a_procedure_name varchar2 := null, a_skip_all_objects boolean := false, a_random_seed positive, - a_tags varchar2 := null + a_tags ut_varchar2_rows := null ) return t_cached_suites_cursor is l_path varchar2( 4000 ); l_result sys_refcursor; l_ut_owner varchar2(250) := ut_utils.ut_owner; l_sql varchar2(32767); l_suite_item_name varchar2(20); + l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows()); begin if a_path is null and a_object_name is not null then execute immediate 'select min(path) @@ -382,7 +382,7 @@ create or replace package body ut_suite_manager is else l_path := lower( a_path ); end if; - l_suite_item_name := case when a_tags is not null then 'suite_items_tags' else 'suite_items' end; + l_suite_item_name := case when l_tags.count > 0 then 'suite_items_tags' else 'suite_items' end; l_sql := q'[with @@ -413,14 +413,13 @@ create or replace package body ut_suite_manager is ) ) ),]' - ||case when a_tags is not null then - q'[ filter_tags as ( - select s.* from suite_items s - where exists - ( select 1 - from ]'||l_ut_owner||q'[.ut_suite_cache_tag ct - where ct.suiteid = s.id and regexp_like(:a_tag_list,'(^|,){1}'||ct.tagname||'(,|$){1}') ) - ), + ||case when l_tags.count > 0 then + q'[ + filter_tags as ( + select c.* + from suite_items c + where c.tags multiset intersect :a_tag_list is not empty + ), suite_items_tags as ( select c.* from suite_items c where exists (select 1 from filter_tags t where @@ -497,7 +496,7 @@ create or replace package body ut_suite_manager is c.path, :a_random_seed ) desc nulls last' end; - open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), a_tags, a_random_seed; + open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tags, a_random_seed; return l_result; end; @@ -585,7 +584,7 @@ create or replace package body ut_suite_manager is a_procedure_name varchar2 := null, a_suites in out nocopy ut_suite_items, a_random_seed positive, - a_tags varchar2 := null + a_tags ut_varchar2_rows := null ) is begin refresh_cache(a_owner_name); @@ -693,9 +692,10 @@ create or replace package body ut_suite_manager is a_suite_path in varchar2, a_procedure_name in varchar2, a_object_name in varchar2, - a_tags in varchar2 + a_tags in ut_varchar2_rows ) return varchar2 is l_error_msg varchar2(500); + l_tags clob:= ut_utils.table_to_clob(coalesce(a_tags,ut_varchar2_rows()),','); begin if a_suite_path is not null then l_error_msg := 'No suite packages found for path '||a_schema_name||':'||a_suite_path; @@ -706,9 +706,9 @@ create or replace package body ut_suite_manager is end if; if l_error_msg is null and a_tags is not null then - l_error_msg := 'No tests found for tags: '||ut_utils.to_string(a_tags,a_max_output_len => gc_tag_errmsg); + l_error_msg := 'No tests found for tags: '||ut_utils.to_string(l_tags,a_max_output_len => gc_tag_errmsg); elsif l_error_msg is not null and a_tags is not null then - l_error_msg := l_error_msg||' with tags: '||ut_utils.to_string(a_tags,a_max_output_len => gc_tag_errmsg); + l_error_msg := l_error_msg||' with tags: '||ut_utils.to_string(l_tags,a_max_output_len => gc_tag_errmsg); end if; l_error_msg := l_error_msg ||'.'; @@ -720,7 +720,7 @@ create or replace package body ut_suite_manager is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags varchar2 := null + a_tags ut_varchar2_rows := null ) is l_paths ut_varchar2_list := a_paths; l_path_items t_path_items; @@ -768,6 +768,7 @@ create or replace package body ut_suite_manager is end configure_execution_by_path; + --TODO : add tags function get_suites_info( a_owner_name varchar2, a_package_name varchar2 := null diff --git a/source/core/ut_suite_manager.pks b/source/core/ut_suite_manager.pks index 5b7c705c6..c27de2eb1 100644 --- a/source/core/ut_suite_manager.pks +++ b/source/core/ut_suite_manager.pks @@ -50,7 +50,7 @@ create or replace package ut_suite_manager authid current_user is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags varchar2 := null + a_tags ut_varchar2_rows := null ); /** diff --git a/source/create_synonyms_and_grants_for_public.sql b/source/create_synonyms_and_grants_for_public.sql index 6cc40afdc..609d78ccf 100644 --- a/source/create_synonyms_and_grants_for_public.sql +++ b/source/create_synonyms_and_grants_for_public.sql @@ -93,7 +93,6 @@ grant select on &&ut3_owner..ut_annotation_cache to public; grant execute on &&ut3_owner..ut_executables to public; grant execute on &&ut3_owner..ut_executable_test to public; grant select on &&ut3_owner..ut_suite_cache to public; -grant select on &&ut3_owner..ut_suite_cache_tag to public; grant select on &&ut3_owner..ut_suite_cache_package to public; grant select on &&ut3_owner..ut_suite_cache_schema to public; grant execute on &&ut3_owner..ut_annotation_cache_manager to public; diff --git a/source/create_user_grants.sql b/source/create_user_grants.sql index ace73b951..7aa5deb39 100644 --- a/source/create_user_grants.sql +++ b/source/create_user_grants.sql @@ -114,7 +114,6 @@ grant select on &&ut3_owner..ut_annotation_cache to &ut3_user; grant execute on &&ut3_owner..ut_executables to &ut3_user; grant execute on &&ut3_owner..ut_executable_test to &ut3_user; grant select on &&ut3_owner..ut_suite_cache to &ut3_user; -grant select on &&ut3_owner..ut_suite_cache_tag to &ut3_user; grant select on &&ut3_owner..ut_suite_cache_package to public; grant select on &&ut3_owner..ut_suite_cache_schema to &ut3_user; grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user; diff --git a/source/install.sql b/source/install.sql index 86669c11d..728f4349f 100644 --- a/source/install.sql +++ b/source/install.sql @@ -130,7 +130,6 @@ alter session set current_schema = &&ut3_owner; @@install_component.sql 'core/ut_suite_cache_package.sql' @@install_component.sql 'core/ut_suite_cache_seq.sql' @@install_component.sql 'core/ut_suite_cache.sql' -@@install_component.sql 'core/ut_suite_cache_tag.sql' @@install_component.sql 'core/ut_suite_cache_manager.pks' @@install_component.sql 'core/ut_suite_cache_manager.pkb' @@install_component.sql 'core/ut_suite_builder.pks' diff --git a/source/uninstall_objects.sql b/source/uninstall_objects.sql index e68b50664..e2295f34d 100644 --- a/source/uninstall_objects.sql +++ b/source/uninstall_objects.sql @@ -63,8 +63,6 @@ drop package ut_suite_manager; drop package ut_suite_builder; -drop table ut_suite_cache_tag; - drop table ut_suite_cache; drop sequence ut_suite_cache_seq; diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 5a9f74992..3bebb500e 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -1149,7 +1149,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%test_procedureSome testsome_package.test_procedure' || - '%testtag%'|| + '%testtag%'|| '%%' ); @@ -1170,7 +1170,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%some_packagetestsuitesome_package' || - '%suitetag%'|| + '%suitetag%'|| '%%' ); @@ -1192,7 +1192,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%test_procedureSome testsome_package.test_procedure' || - '%testtag,testtag2,testtag3%'|| + '%testtagtesttag2testtag3%'|| '%%' ); @@ -1213,7 +1213,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%some_packagetestsuitesome_package' || - '%suitetag,suitetag1,suitetag2%'|| + '%suitetagsuitetag1suitetag2%'|| '%%' ); @@ -1236,7 +1236,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%test_procedureSome testsome_package.test_procedure' || - '%testtag,testtag2%'|| + '%testtagtesttag2%'|| '%%' ); @@ -1258,7 +1258,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%some_packagetestsuitesome_package' || - '%suitetag,suitetag1%'|| + '%suitetagsuitetag1%'|| '%%' ); @@ -1319,7 +1319,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%test_procedureSome testsome_package.test_procedure' || - '%testtag,testtag1,testtag2%'|| + '%testtagtesttag1testtag2%'|| '%%' ); @@ -1341,7 +1341,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%some_packagetestsuitesome_package' || - '%suitetag,suitetag1,suitetag2%'|| + '%suitetagsuitetag1suitetag2%'|| '%%' ); @@ -1363,7 +1363,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%test_procedureSome testsome_package.test_procedure' || - '%testtag,testtag1%'|| + '%testtagtesttag1%'|| '%%' ); @@ -1384,7 +1384,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%some_packagetestsuitesome_package' || - '%suitetag,suitetag1%'|| + '%suitetagsuitetag1%'|| '%%' ); @@ -1406,7 +1406,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%test_procedureSome testsome_package.test_procedure' || - '%#?$%^&*!|\/@][%'|| + '%#?$%^&*!|\/@][%'|| '%%' ); @@ -1427,7 +1427,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_be_like( '%' || '%some_packagetestsuitesome_package' || - '%#?$%^&*!|\/@][%'|| + '%#?$%^&*!|\/@][%'|| '%%' ); From 6d8b09901308e74bdbea8d23f85d4a6592cc7792 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Fri, 26 Apr 2019 07:15:23 +0100 Subject: [PATCH 17/23] Phase 2 : switch to varchar_rows() --- docs/userguide/annotations.md | 29 +++++---- docs/userguide/querying_suites.md | 9 +-- source/api/ut_suite_item_info.tpb | 38 ++++++++++++ source/api/ut_suite_item_info.tps | 5 +- source/core/ut_suite_manager.pkb | 17 +++--- source/core/ut_suite_manager.pks | 2 +- source/install.sql | 1 + test/ut3_tester_helper/run_helper.pkb | 88 +++++++++++++++++++++++++++ test/ut3_tester_helper/run_helper.pks | 3 + test/ut3_user/api/test_ut_runner.pkb | 88 ++++++++++++++++++++++++++- test/ut3_user/api/test_ut_runner.pks | 25 +++++++- 11 files changed, 275 insertions(+), 30 deletions(-) create mode 100644 source/api/ut_suite_item_info.tpb diff --git a/docs/userguide/annotations.md b/docs/userguide/annotations.md index 60a4ed845..84e5f90fc 100644 --- a/docs/userguide/annotations.md +++ b/docs/userguide/annotations.md @@ -1243,7 +1243,7 @@ or -Tags are defined as a coma separated list. When executing a tests filtering by tag utPLSQL will find all tests associated with a given tag and execute it. It will apply `OR` logic when resolving a tags so any tests / suites that got matching at least one tag will get executed. +Tags are defined as a coma separated list. When executing a test run with tag filter applied, framework will find all tests associated with given tags and execute them. Framework applies `OR` logic when resolving a tags so any tests / suites that match at least one tag will be included in the test run. When a suite gets tagged all of its children will automatically inherit a tag and get executed along the parent. Parent suit tests are not executed. but a suitepath hierarchy is kept. @@ -1259,9 +1259,9 @@ create or replace PACKAGE ut_sample_test IS --%tag(test1,sample) PROCEDURE ut_refcursors1; - --%test(Compare Ref Cursors #2) + --%test(Run equality test) --%tag(test2,sample) - PROCEDURE ut_refcursors2; + PROCEDURE ut_test; END ut_sample_test; / @@ -1278,21 +1278,16 @@ create or replace PACKAGE BODY ut_sample_test IS ut.expect(v_actual).to_equal(v_expected); END; - PROCEDURE ut_refcursors2 IS - v_actual SYS_REFCURSOR; - v_expected SYS_REFCURSOR; + PROCEDURE ut_test IS BEGIN - open v_expected for select 1 as test from dual; - open v_actual for select 2 as test from dual; - - ut.expect(v_actual).to_equal(v_expected); + ut.expect(1).to_equal(0); END; END ut_sample_test; / ``` -Execution of the test is done by using a new parameter `a_tags` +Execution of the test is done by using a parameter `a_tags` ```sql select * from table(ut.run(a_path => 'ut_sample_test',a_tags => 'suite1')); @@ -1303,10 +1298,22 @@ begin ut.run(a_path => 'ut_sample_test',a_tags => 'suite1'); end; / + +exec ut.run('ut_sample_test', a_tags => 'sample'); ``` +Tags should adhere to following rules: + +- tags are case sensitive +- tags cannot be an empty string +- tags cannot contain spaces e.g. to create a multi-word `tag` please use underscores,dashes, dots etc. e.g. `test_of_batch` +- tags with empty spaces will be ignored during execution +- tags can contain special characters + + + ### Suitepath It is very likely that the application for which you are going to introduce tests consists of many different packages, procedures and functions. diff --git a/docs/userguide/querying_suites.md b/docs/userguide/querying_suites.md index df973f5ea..e4d4d482c 100644 --- a/docs/userguide/querying_suites.md +++ b/docs/userguide/querying_suites.md @@ -22,21 +22,22 @@ Querying the data from function provides the follwing details: - `item_line_no` - line_number where annotation identifying the item exists - `path` - suitepath of the item - `disabled_flag` - (0/1) indicator if item is disabled by --%disabled annotation - +- `tags` - tags associated with suites + To get list of all test suites in current schema ```sql select * from table(ut_runner.get_suites_info()) where item_type = 'UT_SUITE'; -``` +``` To get list of all tests for test suite `TEST_STUFF` in current user schema ```sql select * from table(ut_runner.get_suites_info(USER, 'TEST_STUFF')) where item_type = 'UT_TEST'; -``` +``` To get a full information about suite `TEST_STUFF` including suite description, all contexts and tests in a suite ```sql select * from table(ut_runner.get_suites_info(USER, 'TEST_STUFF')) where item_type = 'UT_TEST'; -``` +``` ## Checking if schema contains tests diff --git a/source/api/ut_suite_item_info.tpb b/source/api/ut_suite_item_info.tpb new file mode 100644 index 000000000..06ae8341b --- /dev/null +++ b/source/api/ut_suite_item_info.tpb @@ -0,0 +1,38 @@ +create or replace type body ut_suite_item_info is + /* + utPLSQL - Version 3 + Copyright 2016 - 2018 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. + */ + constructor function ut_suite_item_info(a_object_owner varchar2, a_object_name varchar2, a_item_name varchar2, + a_item_description varchar2, a_item_type varchar2, a_item_line_no integer, a_path varchar2, a_disabled_flag integer, + a_tags ut_varchar2_rows) return self as result is + begin + self.object_owner := a_object_owner; + self.object_name := a_object_name; + self.item_name := a_item_name; + self.item_description := a_item_description; + self.item_type := a_item_type; + self.item_line_no := a_item_line_no; + self.path := a_path; + self.disabled_flag := a_disabled_flag; + self.tags := case + when a_tags is null then null + when a_tags.count = 0 then null + else ut_utils.to_string(ut_utils.table_to_clob(a_tags,',') ,a_quote_char => null) + end; + return; + end; +end; +/ diff --git a/source/api/ut_suite_item_info.tps b/source/api/ut_suite_item_info.tps index b0c77acb6..d7f7f97dc 100644 --- a/source/api/ut_suite_item_info.tps +++ b/source/api/ut_suite_item_info.tps @@ -23,6 +23,9 @@ create or replace type ut_suite_item_info as object ( item_line_no integer, -- line_number where annotation identifying the item exists path varchar2( 4000 ),-- suitepath of the item disabled_flag integer, -- 0 (zero) if item is not disabled, 1 if item is disabled by --%disabled annotation - tags varchar2(4000) + tags varchar2(4000), + constructor function ut_suite_item_info(a_object_owner varchar2, a_object_name varchar2, a_item_name varchar2, + a_item_description varchar2, a_item_type varchar2, a_item_line_no integer, a_path varchar2, a_disabled_flag integer, + a_tags ut_varchar2_rows) return self as result ) / diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 768c0af6f..3e41ab58b 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -692,7 +692,7 @@ create or replace package body ut_suite_manager is a_suite_path in varchar2, a_procedure_name in varchar2, a_object_name in varchar2, - a_tags in ut_varchar2_rows + a_tags in ut_varchar2_rows := ut_varchar2_rows() ) return varchar2 is l_error_msg varchar2(500); l_tags clob:= ut_utils.table_to_clob(coalesce(a_tags,ut_varchar2_rows()),','); @@ -705,9 +705,9 @@ create or replace package body ut_suite_manager is l_error_msg := 'Suite package '||a_schema_name||'.'||a_object_name|| ' does not exists'; end if; - if l_error_msg is null and a_tags is not null then + if l_error_msg is null and a_tags.count > 0 then l_error_msg := 'No tests found for tags: '||ut_utils.to_string(l_tags,a_max_output_len => gc_tag_errmsg); - elsif l_error_msg is not null and a_tags is not null then + elsif l_error_msg is not null and a_tags.count > 0 then l_error_msg := l_error_msg||' with tags: '||ut_utils.to_string(l_tags,a_max_output_len => gc_tag_errmsg); end if; @@ -720,7 +720,7 @@ create or replace package body ut_suite_manager is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags ut_varchar2_rows := null + a_tags ut_varchar2_rows := ut_varchar2_rows() ) is l_paths ut_varchar2_list := a_paths; l_path_items t_path_items; @@ -768,7 +768,6 @@ create or replace package body ut_suite_manager is end configure_execution_by_path; - --TODO : add tags function get_suites_info( a_owner_name varchar2, a_package_name varchar2 := null @@ -779,7 +778,7 @@ create or replace package body ut_suite_manager is refresh_cache(a_owner_name); - open l_result for + open l_result for q'[with suite_items as ( select /*+ cardinality(c 100) */ c.* @@ -831,17 +830,17 @@ create or replace package body ut_suite_manager is items as ( select object_owner, object_name, name as item_name, description as item_description, self_type as item_type, line_no as item_line_no, - path, disabled_flag + path, disabled_flag,tags from suite_items union all select object_owner, object_name, object_name as item_name, null as item_description, item_type, null as item_line_no, - s.path, 0 as disabled_flag + s.path, 0 as disabled_flag, ]'||l_ut_owner||q'[.ut_varchar2_rows() as tags from logical_suites s ) select ]'||l_ut_owner||q'[.ut_suite_item_info( object_owner, object_name, item_name, item_description, - item_type, item_line_no, path, disabled_flag + item_type, item_line_no, path, disabled_flag, tags ) from items c]' using upper(a_package_name); diff --git a/source/core/ut_suite_manager.pks b/source/core/ut_suite_manager.pks index c27de2eb1..bf8819693 100644 --- a/source/core/ut_suite_manager.pks +++ b/source/core/ut_suite_manager.pks @@ -50,7 +50,7 @@ create or replace package ut_suite_manager authid current_user is a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, a_random_seed in positive := null, - a_tags ut_varchar2_rows := null + a_tags ut_varchar2_rows := ut_varchar2_rows() ); /** diff --git a/source/install.sql b/source/install.sql index 728f4349f..465beaa48 100644 --- a/source/install.sql +++ b/source/install.sql @@ -279,6 +279,7 @@ prompt Installing DBMSPLSQL Tables objects into &&ut3_owner schema --plugin interface API for running utPLSQL @@install_component.sql 'api/ut_suite_item_info.tps' +@@install_component.sql 'api/ut_suite_item_info.tpb' @@install_component.sql 'api/ut_suite_items_info.tps' @@install_component.sql 'api/ut_runner.pks' @@install_component.sql 'api/ut_runner.pkb' diff --git a/test/ut3_tester_helper/run_helper.pkb b/test/ut3_tester_helper/run_helper.pkb index 45403ca8a..2f4c9a86e 100644 --- a/test/ut3_tester_helper/run_helper.pkb +++ b/test/ut3_tester_helper/run_helper.pkb @@ -27,6 +27,94 @@ create or replace package body run_helper is execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]'; end; + procedure setup_cache_objectstag is + pragma autonomous_transaction; + begin + execute immediate q'[create or replace package ut3$user#.dummy_test_package as + --%suite(dummy_test_suite) + --%tags(dummy) + --%rollback(manual) + + --%test(dummy_test) + --%tags(testtag) + --%beforetest(some_procedure) + procedure some_dummy_test_procedure; + end;]'; + execute immediate q'[create or replace procedure ut3$user#.dummy_test_procedure as + --%some_annotation(some_text) + --%rollback(manual) + begin + null; + end;]'; + execute immediate q'[create or replace procedure ut3_tester_helper.dummy_test_procedure as + --%some_annotation(some_text) + --%rollback(manual) + begin + null; + end;]'; + + execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]'; + end; + + procedure setup_cache_twotags is + pragma autonomous_transaction; + begin + execute immediate q'[create or replace package ut3$user#.dummy_test_package as + --%suite(dummy_test_suite) + --%tags(suitetag1,suitetag2) + --%rollback(manual) + + --%test(dummy_test) + --%tags(testtag1,testtag2) + --%beforetest(some_procedure) + procedure some_dummy_test_procedure; + end;]'; + execute immediate q'[create or replace procedure ut3$user#.dummy_test_procedure as + --%some_annotation(some_text) + --%rollback(manual) + begin + null; + end;]'; + execute immediate q'[create or replace procedure ut3_tester_helper.dummy_test_procedure as + --%some_annotation(some_text) + --%rollback(manual) + begin + null; + end;]'; + + execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]'; + end; + + procedure setup_cache_longtags is + pragma autonomous_transaction; + begin + execute immediate q'[create or replace package ut3$user#.dummy_test_package as + --%suite(dummy_test_suite) + --%tags(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) + --%rollback(manual) + + --%test(dummy_test) + --%tags(testtag1,testtag2) + --%beforetest(some_procedure) + procedure some_dummy_test_procedure; + end;]'; + execute immediate q'[create or replace procedure ut3$user#.dummy_test_procedure as + --%some_annotation(some_text) + --%rollback(manual) + begin + null; + end;]'; + execute immediate q'[create or replace procedure ut3_tester_helper.dummy_test_procedure as + --%some_annotation(some_text) + --%rollback(manual) + begin + null; + end;]'; + + execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]'; + end; + procedure create_trans_control is pragma autonomous_transaction; begin diff --git a/test/ut3_tester_helper/run_helper.pks b/test/ut3_tester_helper/run_helper.pks index 45c64741c..e79549f3e 100644 --- a/test/ut3_tester_helper/run_helper.pks +++ b/test/ut3_tester_helper/run_helper.pks @@ -6,6 +6,9 @@ create or replace package run_helper is type prof_runs_tab is table of ut3.plsql_profiler_runs%rowtype; procedure setup_cache_objects; + procedure setup_cache_objectstag; + procedure setup_cache_twotags; + procedure setup_cache_longtags; procedure setup_cache; procedure cleanup_cache; procedure create_db_link; diff --git a/test/ut3_user/api/test_ut_runner.pkb b/test/ut3_user/api/test_ut_runner.pkb index 298c15c2a..d58f4832d 100644 --- a/test/ut3_user/api/test_ut_runner.pkb +++ b/test/ut3_user/api/test_ut_runner.pkb @@ -5,6 +5,21 @@ create or replace package body test_ut_runner is ut3_tester_helper.run_helper.setup_cache_objects(); end; + procedure setup_cache_objectstag is + begin + ut3_tester_helper.run_helper.setup_cache_objectstag(); + end; + + procedure setup_cache_twotags is + begin + ut3_tester_helper.run_helper.setup_cache_twotags(); + end; + + procedure setup_cache_longtags is + begin + ut3_tester_helper.run_helper.setup_cache_longtags(); + end; + procedure setup_cache is begin ut3_tester_helper.run_helper.setup_cache(); @@ -238,7 +253,7 @@ end;'; ut.expect(l_actual).to_equal(0); end; - procedure test_get_suites_info is + procedure test_get_suites_info_notag is l_expected sys_refcursor; l_actual sys_refcursor; begin @@ -247,12 +262,79 @@ end;'; select 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name, 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no, - 'dummy_test_package' path, 0 disabled_flag + 'dummy_test_package' path, 0 disabled_flag,null tags from dual union all select 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name, 'dummy_test' item_description, 'UT_TEST' item_type, 5 item_line_no, - 'dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag + 'dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag,null tags + from dual; + --Act + open l_actual for select * from table(ut3.ut_runner.get_suites_info('UT3$USER#','DUMMY_TEST_PACKAGE')); + --Assert + ut.expect(l_actual).to_equal(l_expected); + end; + + --TODO : Apostro????? + procedure test_get_suites_info_tag is + l_expected sys_refcursor; + l_actual sys_refcursor; + begin + --Arrange + open l_expected for + select + 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name, + 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no, + 'dummy_test_package' path, 0 disabled_flag,'dummy' tags + from dual union all + select + 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name, + 'dummy_test' item_description, 'UT_TEST' item_type, 6 item_line_no, + 'dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag,'testtag' tags + from dual; + --Act + open l_actual for select * from table(ut3.ut_runner.get_suites_info('UT3$USER#','DUMMY_TEST_PACKAGE')); + --Assert + ut.expect(l_actual).to_equal(l_expected); + end; + + procedure test_get_suites_info_twotag is + l_expected sys_refcursor; + l_actual sys_refcursor; + begin + --Arrange + open l_expected for + select + 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name, + 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no, + 'dummy_test_package' path, 0 disabled_flag,'suitetag1,suitetag2' tags + from dual union all + select + 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name, + 'dummy_test' item_description, 'UT_TEST' item_type, 6 item_line_no, + 'dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag,'testtag1,testtag2' tags + from dual; + --Act + open l_actual for select * from table(ut3.ut_runner.get_suites_info('UT3$USER#','DUMMY_TEST_PACKAGE')); + --Assert + ut.expect(l_actual).to_equal(l_expected); + end; + + procedure test_get_suites_info_longtag is + l_expected sys_refcursor; + l_actual sys_refcursor; + begin + --Arrange + open l_expected for + select + 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name, + 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no, + 'dummy_test_package' path, 0 disabled_flag,'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[...]' tags + from dual union all + select + 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name, + 'dummy_test' item_description, 'UT_TEST' item_type, 7 item_line_no, + 'dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag,'testtag1,testtag2' tags from dual; --Act open l_actual for select * from table(ut3.ut_runner.get_suites_info('UT3$USER#','DUMMY_TEST_PACKAGE')); diff --git a/test/ut3_user/api/test_ut_runner.pks b/test/ut3_user/api/test_ut_runner.pks index 70eed747f..2ddeff401 100644 --- a/test/ut3_user/api/test_ut_runner.pks +++ b/test/ut3_user/api/test_ut_runner.pks @@ -41,6 +41,9 @@ create or replace package test_ut_runner is procedure test_purge_cache_schema_type; procedure setup_cache_objects; + procedure setup_cache_objectstag; + procedure setup_cache_twotags; + procedure setup_cache_longtags; --%test(Rebuilds cache for a given schema and object type) --%beforetest(setup_cache_objects) @@ -50,7 +53,27 @@ create or replace package test_ut_runner is --%test(get_suites_info returns a cursor containing records for a newly created test) --%beforetest(setup_cache_objects) --%aftertest(cleanup_cache) - procedure test_get_suites_info; + procedure test_get_suites_info_notag; + + --%test(get_suites_info returns a cursor containing records for a newly created test with tag) + --%beforetest(setup_cache_objectstag) + --%aftertest(cleanup_cache) + procedure test_get_suites_info_tag; + + --%test(get_suites_info returns a cursor containing records for a newly created test with two tags) + --%beforetest(setup_cache_twotags) + --%aftertest(cleanup_cache) + procedure test_get_suites_info_twotag; + + /*** + * This test at the moment is not possible to correctly run due to limit of to_string when + * displaying a diff message returnign max 4k char. + */ + --%test(get_suites_info returns a cursor containing records for a newly created test with long tag) + --%beforetest(setup_cache_longtags) + --%aftertest(cleanup_cache) + --%disabled + procedure test_get_suites_info_longtag; --%test(get_reporters_list returns a cursor containing all built-in reporters and information about output-reporter) --%beforetest(setup_cache_objects) From 957ea8bdf8ae2f9dff452c9a9532494f7e779a32 Mon Sep 17 00:00:00 2001 From: lwasylow Date: Sun, 28 Apr 2019 10:46:03 +0100 Subject: [PATCH 18/23] Remove a 4k tests --- test/ut3_tester_helper/run_helper.pkb | 30 --------------------------- test/ut3_tester_helper/run_helper.pks | 1 - test/ut3_user/api/test_ut_runner.pkb | 27 ------------------------ test/ut3_user/api/test_ut_runner.pks | 11 ---------- 4 files changed, 69 deletions(-) diff --git a/test/ut3_tester_helper/run_helper.pkb b/test/ut3_tester_helper/run_helper.pkb index 2f4c9a86e..9bc2b7f79 100644 --- a/test/ut3_tester_helper/run_helper.pkb +++ b/test/ut3_tester_helper/run_helper.pkb @@ -85,36 +85,6 @@ create or replace package body run_helper is execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]'; end; - procedure setup_cache_longtags is - pragma autonomous_transaction; - begin - execute immediate q'[create or replace package ut3$user#.dummy_test_package as - --%suite(dummy_test_suite) - --%tags(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) - --%rollback(manual) - - --%test(dummy_test) - --%tags(testtag1,testtag2) - --%beforetest(some_procedure) - procedure some_dummy_test_procedure; - end;]'; - execute immediate q'[create or replace procedure ut3$user#.dummy_test_procedure as - --%some_annotation(some_text) - --%rollback(manual) - begin - null; - end;]'; - execute immediate q'[create or replace procedure ut3_tester_helper.dummy_test_procedure as - --%some_annotation(some_text) - --%rollback(manual) - begin - null; - end;]'; - - execute immediate q'[grant execute on ut3_tester_helper.dummy_test_procedure to public]'; - end; - procedure create_trans_control is pragma autonomous_transaction; begin diff --git a/test/ut3_tester_helper/run_helper.pks b/test/ut3_tester_helper/run_helper.pks index e79549f3e..e06401eae 100644 --- a/test/ut3_tester_helper/run_helper.pks +++ b/test/ut3_tester_helper/run_helper.pks @@ -8,7 +8,6 @@ create or replace package run_helper is procedure setup_cache_objects; procedure setup_cache_objectstag; procedure setup_cache_twotags; - procedure setup_cache_longtags; procedure setup_cache; procedure cleanup_cache; procedure create_db_link; diff --git a/test/ut3_user/api/test_ut_runner.pkb b/test/ut3_user/api/test_ut_runner.pkb index d58f4832d..e282963cb 100644 --- a/test/ut3_user/api/test_ut_runner.pkb +++ b/test/ut3_user/api/test_ut_runner.pkb @@ -15,11 +15,6 @@ create or replace package body test_ut_runner is ut3_tester_helper.run_helper.setup_cache_twotags(); end; - procedure setup_cache_longtags is - begin - ut3_tester_helper.run_helper.setup_cache_longtags(); - end; - procedure setup_cache is begin ut3_tester_helper.run_helper.setup_cache(); @@ -320,28 +315,6 @@ end;'; ut.expect(l_actual).to_equal(l_expected); end; - procedure test_get_suites_info_longtag is - l_expected sys_refcursor; - l_actual sys_refcursor; - begin - --Arrange - open l_expected for - select - 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DUMMY_TEST_PACKAGE' item_name, - 'dummy_test_suite' item_description, 'UT_SUITE' item_type, 2 item_line_no, - 'dummy_test_package' path, 0 disabled_flag,'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[...]' tags - from dual union all - select - 'UT3$USER#' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'SOME_DUMMY_TEST_PROCEDURE' item_name, - 'dummy_test' item_description, 'UT_TEST' item_type, 7 item_line_no, - 'dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag,'testtag1,testtag2' tags - from dual; - --Act - open l_actual for select * from table(ut3.ut_runner.get_suites_info('UT3$USER#','DUMMY_TEST_PACKAGE')); - --Assert - ut.expect(l_actual).to_equal(l_expected); - end; - procedure test_get_reporters_list is l_expected sys_refcursor; l_actual sys_refcursor; diff --git a/test/ut3_user/api/test_ut_runner.pks b/test/ut3_user/api/test_ut_runner.pks index 2ddeff401..967009c61 100644 --- a/test/ut3_user/api/test_ut_runner.pks +++ b/test/ut3_user/api/test_ut_runner.pks @@ -43,7 +43,6 @@ create or replace package test_ut_runner is procedure setup_cache_objects; procedure setup_cache_objectstag; procedure setup_cache_twotags; - procedure setup_cache_longtags; --%test(Rebuilds cache for a given schema and object type) --%beforetest(setup_cache_objects) @@ -65,16 +64,6 @@ create or replace package test_ut_runner is --%aftertest(cleanup_cache) procedure test_get_suites_info_twotag; - /*** - * This test at the moment is not possible to correctly run due to limit of to_string when - * displaying a diff message returnign max 4k char. - */ - --%test(get_suites_info returns a cursor containing records for a newly created test with long tag) - --%beforetest(setup_cache_longtags) - --%aftertest(cleanup_cache) - --%disabled - procedure test_get_suites_info_longtag; - --%test(get_reporters_list returns a cursor containing all built-in reporters and information about output-reporter) --%beforetest(setup_cache_objects) --%aftertest(cleanup_cache) From 2a9155146da957678e3f247ef96d4d44bd5de07f Mon Sep 17 00:00:00 2001 From: lwasylow Date: Sun, 28 Apr 2019 10:48:15 +0100 Subject: [PATCH 19/23] Added constant --- source/core/ut_suite_builder.pkb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index 245a49b76..f732bb004 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -16,6 +16,11 @@ create or replace package body ut_suite_builder is limitations under the License. */ + /** + * Regexp to validate tag + */ + gc_word_no_space constant varchar2(50) := '^(\w|\S)+$'; + subtype t_annotation_text is varchar2(4000); subtype t_annotation_name is varchar2(4000); subtype t_object_name is varchar2(500); @@ -329,7 +334,7 @@ create or replace package body ut_suite_builder is ); end if; --remove empty strings from table list e.g. tag1,,tag2 and conver to rows - a_list := ut_utils.convert_collection( ut_utils.filter_list(l_tag_list,'^(\w|\S)+$') ); + a_list := ut_utils.convert_collection( ut_utils.filter_list(l_tag_list,gc_word_no_space) ); l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; @@ -641,7 +646,7 @@ create or replace package body ut_suite_builder is l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; --remove empty strings from table list e.g. tag1,,tag2 - a_suite.tags := ut_utils.convert_collection(ut_utils.filter_list(l_tag_list,'^(\w|\S)+$')); + a_suite.tags := ut_utils.convert_collection(ut_utils.filter_list(l_tag_list,gc_word_no_space)); end; procedure add_suite_tests( From d00a0f783a005e5e7bb3d8dec638e5fac35c54ee Mon Sep 17 00:00:00 2001 From: lwasylow Date: Mon, 29 Apr 2019 07:25:31 +0100 Subject: [PATCH 20/23] Updates to PR. Switch to common add tags to suite item --- docs/userguide/annotations.md | 28 +++++------ source/api/ut_runner.pkb | 2 +- source/core/ut_suite_builder.pkb | 51 ++++----------------- source/core/ut_suite_manager.pkb | 41 ++++------------- source/core/ut_utils.pks | 5 ++ test/ut3_tester/core/test_suite_builder.pkb | 2 +- test/ut3_user/api/test_ut_run.pkb | 22 ++------- test/ut3_user/api/test_ut_run.pks | 3 -- test/ut3_user/api/test_ut_runner.pkb | 1 - 9 files changed, 42 insertions(+), 113 deletions(-) diff --git a/docs/userguide/annotations.md b/docs/userguide/annotations.md index 296616f28..51bfa7abf 100644 --- a/docs/userguide/annotations.md +++ b/docs/userguide/annotations.md @@ -1250,40 +1250,40 @@ When a suite gets tagged all of its children will automatically inherit a tag an Sample tag package. ```sql -create or replace PACKAGE ut_sample_test IS +create or replace package ut_sample_test IS --%suite(Sample Test Suite) --%tag(suite1) --%test(Compare Ref Cursors) --%tag(test1,sample) - PROCEDURE ut_refcursors1; + procedure ut_refcursors1; --%test(Run equality test) --%tag(test2,sample) - PROCEDURE ut_test; + procedure ut_test; -END ut_sample_test; +end ut_sample_test; / -create or replace PACKAGE BODY ut_sample_test IS +create or replace package body ut_sample_test is - PROCEDURE ut_refcursors1 IS - v_actual SYS_REFCURSOR; - v_expected SYS_REFCURSOR; - BEGIN + procedure ut_refcursors1 is + v_actual sys_refcursor; + v_expected sys_refcursor; + begin open v_expected for select 1 as test from dual; open v_actual for select 2 as test from dual; ut.expect(v_actual).to_equal(v_expected); - END; + end; - PROCEDURE ut_test IS - BEGIN + procedure ut_test is + begin ut.expect(1).to_equal(0); - END; + end; -END ut_sample_test; +end ut_sample_test; / ``` diff --git a/source/api/ut_runner.pkb b/source/api/ut_runner.pkb index 5a9cc856a..d57b86edd 100644 --- a/source/api/ut_runner.pkb +++ b/source/api/ut_runner.pkb @@ -143,7 +143,7 @@ create or replace package body ut_runner is if a_tags is not null then l_tags := l_tags multiset union distinct ut_utils.convert_collection( - ut_utils.filter_list(ut_utils.string_to_table(a_tags,','),'^(\w|\S)+$') + ut_utils.trim_list_elements(ut_utils.filter_list(ut_utils.string_to_table(a_tags,','),ut_utils.gc_word_no_space)) ); end if; l_exclude_object_names := l_exclude_object_names multiset union all ut_suite_manager.get_schema_ut_packages(l_coverage_schema_names); diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index f732bb004..eab4d48b1 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -15,11 +15,6 @@ create or replace package body ut_suite_builder is See the License for the specific language governing permissions and limitations under the License. */ - - /** - * Regexp to validate tag - */ - gc_word_no_space constant varchar2(50) := '^(\w|\S)+$'; subtype t_annotation_text is varchar2(4000); subtype t_annotation_name is varchar2(4000); @@ -311,13 +306,13 @@ create or replace package body ut_suite_builder is l_annotation_pos := a_throws_ann_text.next(l_annotation_pos); end loop; end; - - procedure add_tags_to_test( + + procedure add_tags_to_suite_item( a_suite in out nocopy ut_suite, + a_tags_ann_text tt_annotation_texts, a_list in out nocopy ut_varchar2_rows, - a_procedure_name t_object_name, - a_tags_ann_text tt_annotation_texts - ) is + a_procedure_name t_object_name := null + ) is l_annotation_pos binary_integer; l_tag_list ut_varchar2_list := ut_varchar2_list(); begin @@ -333,14 +328,12 @@ create or replace package body ut_suite_builder is ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos),',') ); end if; - --remove empty strings from table list e.g. tag1,,tag2 and conver to rows - a_list := ut_utils.convert_collection( ut_utils.filter_list(l_tag_list,gc_word_no_space) ); l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); end loop; - + --remove empty strings from table list e.g. tag1,,tag2 and conver to rows + a_list := ut_utils.convert_collection( ut_utils.filter_list(l_tag_list,ut_utils.gc_word_no_space) ); end; - - + procedure set_seq_no( a_list in out nocopy ut_executables ) is @@ -521,7 +514,7 @@ create or replace package body ut_suite_builder is end if; if l_proc_annotations.exists( gc_tag) then - add_tags_to_test(a_suite, l_test.tags, a_procedure_name, l_proc_annotations( gc_tag)); + add_tags_to_suite_item(a_suite, l_proc_annotations( gc_tag), l_test.tags, a_procedure_name); end if; if l_proc_annotations.exists( gc_throws) then @@ -625,30 +618,6 @@ create or replace package body ut_suite_builder is a_suite.path := lower(coalesce(a_suite.path, a_suite.object_name)); end; - procedure add_tags_to_suite( - a_suite in out nocopy ut_suite, - a_tags_ann_text tt_annotation_texts - ) is - l_annotation_pos binary_integer; - l_tag_list ut_varchar2_list := ut_varchar2_list(); - begin - l_annotation_pos := a_tags_ann_text.first; - while l_annotation_pos is not null loop - if a_tags_ann_text(l_annotation_pos) is null then - a_suite.put_warning( - '"--%tags" annotation requires a tag value populated. Annotation ignored, line ' || l_annotation_pos - ); - else - l_tag_list := l_tag_list multiset union distinct ut_utils.trim_list_elements( - ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos),',') - ); - end if; - l_annotation_pos := a_tags_ann_text.next(l_annotation_pos); - end loop; - --remove empty strings from table list e.g. tag1,,tag2 - a_suite.tags := ut_utils.convert_collection(ut_utils.filter_list(l_tag_list,gc_word_no_space)); - end; - procedure add_suite_tests( a_suite in out nocopy ut_suite, a_annotations t_annotations_info, @@ -699,7 +668,7 @@ create or replace package body ut_suite_builder is end if; if a_annotations.by_name.exists(gc_tag) then - add_tags_to_suite(a_suite, a_annotations.by_name(gc_tag)); + add_tags_to_suite_item(a_suite, a_annotations.by_name(gc_tag),a_suite.tags); end if; a_suite.disabled_flag := ut_utils.boolean_to_int(a_annotations.by_name.exists(gc_disabled)); diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 3e41ab58b..edbce7d5b 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -17,7 +17,7 @@ create or replace package body ut_suite_manager is */ gc_suitpath_error_message constant varchar2(100) := 'Suitepath exceeds 1000 CHAR on: '; - gc_tag_errmsg constant number := 450; + gc_tag_errmsg constant integer := 450; type t_path_item is record ( object_name varchar2(250), @@ -687,35 +687,6 @@ create or replace package body ut_suite_manager is return l_suites; end; - function build_no_test_error_msg( - a_schema_name in varchar2, - a_suite_path in varchar2, - a_procedure_name in varchar2, - a_object_name in varchar2, - a_tags in ut_varchar2_rows := ut_varchar2_rows() - ) return varchar2 is - l_error_msg varchar2(500); - l_tags clob:= ut_utils.table_to_clob(coalesce(a_tags,ut_varchar2_rows()),','); - begin - if a_suite_path is not null then - l_error_msg := 'No suite packages found for path '||a_schema_name||':'||a_suite_path; - elsif a_procedure_name is not null then - l_error_msg := 'Suite test '||a_schema_name||'.'||a_object_name|| '.'||a_procedure_name||' does not exists'; - elsif a_object_name is not null then - l_error_msg := 'Suite package '||a_schema_name||'.'||a_object_name|| ' does not exists'; - end if; - - if l_error_msg is null and a_tags.count > 0 then - l_error_msg := 'No tests found for tags: '||ut_utils.to_string(l_tags,a_max_output_len => gc_tag_errmsg); - elsif l_error_msg is not null and a_tags.count > 0 then - l_error_msg := l_error_msg||' with tags: '||ut_utils.to_string(l_tags,a_max_output_len => gc_tag_errmsg); - end if; - - l_error_msg := l_error_msg ||'.'; - - return l_error_msg; - end; - procedure configure_execution_by_path( a_paths in ut_varchar2_list, a_suites out nocopy ut_suite_items, @@ -751,9 +722,13 @@ create or replace package body ut_suite_manager is a_tags ); if a_suites.count = l_suites_count then - raise_application_error(ut_utils.gc_suite_package_not_found,build_no_test_error_msg( - l_schema,l_path_item.suite_path,l_path_item.procedure_name, - l_path_item.object_name,a_tags)); + if l_path_item.suite_path is not null then + raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for path '||l_schema||':'||l_path_item.suite_path|| '.'); + elsif l_path_item.procedure_name is not null then + raise_application_error(ut_utils.gc_suite_package_not_found,'Suite test '||l_schema||'.'||l_path_item.object_name|| '.'||l_path_item.procedure_name||' does not exist'); + elsif l_path_item.object_name is not null then + raise_application_error(ut_utils.gc_suite_package_not_found,'Suite package '||l_schema||'.'||l_path_item.object_name|| ' does not exist'); + end if; end if; l_index := a_suites.first; l_suites_count := a_suites.count; diff --git a/source/core/ut_utils.pks b/source/core/ut_utils.pks index dfef91489..69a8824d4 100644 --- a/source/core/ut_utils.pks +++ b/source/core/ut_utils.pks @@ -131,6 +131,11 @@ create or replace package ut_utils authid definer is gc_bc_fetch_limit constant integer := 1000; gc_diff_max_rows constant integer := 20; + /** + * Regexp to validate tag + */ + gc_word_no_space constant varchar2(50) := '^(\w|\S)+$'; + type t_version is record( major natural, minor natural, diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 3bebb500e..523d31a3d 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -1296,7 +1296,7 @@ create or replace package body test_suite_builder is l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE'); --Assert ut.expect(l_actual).to_be_like( - '%"--%tags" annotation requires a tag value populated. Annotation ignored, line 3%'|| + '%"--%tags" annotation requires a tag value populated. Annotation ignored.%%'|| '%%' ); diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb index 60c9a7dc8..857492f58 100644 --- a/test/ut3_user/api/test_ut_run.pkb +++ b/test/ut3_user/api/test_ut_run.pkb @@ -875,14 +875,11 @@ Failures:% l_results clob; l_exp_message varchar2(4000); begin - l_exp_message :=q'[ORA-20204: No tests found for tags: 'nonexisting'.]'; ut3_tester_helper.run_helper.run(a_tags => 'nonexisting'); l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); - ut.fail('Expecte test to fail'); - --Assert - exception - when others then - ut.expect( sqlerrm ).to_be_like( l_exp_message ); + ut.expect( l_results ).not_to_be_like( '%test_package_1%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_2%' ); + ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); end; procedure test_duplicate_tag is @@ -906,19 +903,6 @@ Failures:% ut.expect( l_results ).to_be_like( '%test_package_2%' ); ut.expect( l_results ).not_to_be_like( '%test_package_3%' ); end; - - procedure run_proc_pkg_name_no_tag is - l_results clob; - l_exp_message varchar2(4000); - begin - l_exp_message :=q'[ORA-20204: Suite package ut3_tester_helper.test_package_1 does not exists with tags: 'nonexists'.]'; - ut3.ut.run('ut3_tester_helper.test_package_1',a_tags => 'nonexists'); - l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob(); - ut.fail('Expecte test to fail'); - exception - when others then - ut.expect( sqlerrm ).to_be_like( l_exp_message ); - end; procedure run_proc_pkg_name_tag is l_results clob; diff --git a/test/ut3_user/api/test_ut_run.pks b/test/ut3_user/api/test_ut_run.pks index fcb62e207..4616763d0 100644 --- a/test/ut3_user/api/test_ut_run.pks +++ b/test/ut3_user/api/test_ut_run.pks @@ -198,9 +198,6 @@ create or replace package test_ut_run is --%test(Execute suite test for duplicate list tags) procedure suite_duplicate_tag; - --%test(Run a package by name with non existing tag) - procedure run_proc_pkg_name_no_tag; - --%test(Runs given package only with package name given as path and filter by tag) procedure run_proc_pkg_name_tag; diff --git a/test/ut3_user/api/test_ut_runner.pkb b/test/ut3_user/api/test_ut_runner.pkb index e282963cb..3ff0a4850 100644 --- a/test/ut3_user/api/test_ut_runner.pkb +++ b/test/ut3_user/api/test_ut_runner.pkb @@ -270,7 +270,6 @@ end;'; ut.expect(l_actual).to_equal(l_expected); end; - --TODO : Apostro????? procedure test_get_suites_info_tag is l_expected sys_refcursor; l_actual sys_refcursor; From 31643107b21f13da0896ec60f4ce7337772485ad Mon Sep 17 00:00:00 2001 From: lwasylow Date: Mon, 29 Apr 2019 13:34:08 +0100 Subject: [PATCH 21/23] Move query to template to simplify view --- source/core/ut_suite_manager.pkb | 252 ++++++++++++++++++------------- 1 file changed, 146 insertions(+), 106 deletions(-) diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index edbce7d5b..554085277 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -19,6 +19,70 @@ create or replace package body ut_suite_manager is gc_suitpath_error_message constant varchar2(100) := 'Suitepath exceeds 1000 CHAR on: '; gc_tag_errmsg constant integer := 450; + gc_get_cache_suite_sql constant varchar2(32767) := + q'[with + suite_items as ( + select /*+ cardinality(c 100) */ c.* + from {:owner:}.ut_suite_cache c + where 1 = 1 {:object_list:} + and c.object_owner = '{:object_owner:}' + and ( {:path:} + and {:object_name:} + and {:procedure_name:} + ) + ) + ), + {:tags:}, + suitepaths as ( + select distinct substr(path,1,instr(path,'.',-1)-1) as suitepath, + path, + object_owner + from {:suite_item_name:} + where self_type = 'UT_SUITE' + ), + gen as ( + select rownum as pos + from xmltable('1 to 20') + ), + suitepath_part AS ( + select distinct + substr(b.suitepath, 1, instr(b.suitepath || '.', '.', 1, g.pos) -1) as path, + object_owner + from suitepaths b + join gen g + on g.pos <= regexp_count(b.suitepath, '\w+') + ), + logical_suite_data as ( + select 'UT_LOGICAL_SUITE' as self_type, p.path, p.object_owner, + upper( substr(p.path, instr( p.path, '.', -1 ) + 1 ) ) as object_name, + cast(null as {:owner:}.ut_executables) as x, + cast(null as {:owner:}.ut_integer_list) as y, + cast(null as {:owner:}.ut_executable_test) as z + from suitepath_part p + where p.path + not in (select s.path from suitepaths s) + ), + logical_suites as ( + select to_number(null) as id, s.self_type, s.path, s.object_owner, s.object_name, + s.object_name as name, null as line_no, null as parse_time, + null as description, null as rollback_type, 0 as disabled_flag, + {:owner:}.ut_varchar2_rows() as warnings, + s.x as before_all_list, s.x as after_all_list, + s.x as before_each_list, s.x as before_test_list, + s.x as after_each_list, s.x as after_test_list, + s.y as expected_error_codes, null as test_tags, + s.z as item + from logical_suite_data s + ), + items as ( + select * from {:suite_item_name:} + union all + select * from logical_suites + ) + select c.* + from items c + order by c.object_owner,{:random_seed:}]'; + type t_path_item is record ( object_name varchar2(250), procedure_name varchar2(250), @@ -330,7 +394,7 @@ create or replace package body ut_suite_manager is end loop; close a_suite_data_cursor; end reconstruct_from_cache; - + function get_missing_objects(a_object_owner varchar2) return ut_varchar2_rows is l_rows sys_refcursor; l_ut_owner varchar2(250) := ut_utils.ut_owner; @@ -356,66 +420,46 @@ create or replace package body ut_suite_manager is return l_result; end; - function get_cached_suite_data( - a_object_owner varchar2, - a_path varchar2 := null, - a_object_name varchar2 := null, - a_procedure_name varchar2 := null, - a_skip_all_objects boolean := false, - a_random_seed positive, - a_tags ut_varchar2_rows := null - ) return t_cached_suites_cursor is - l_path varchar2( 4000 ); - l_result sys_refcursor; - l_ut_owner varchar2(250) := ut_utils.ut_owner; - l_sql varchar2(32767); - l_suite_item_name varchar2(20); - l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows()); + function get_object_names_sql(a_skip_all_objects boolean ) return varchar2 is begin - if a_path is null and a_object_name is not null then - execute immediate 'select min(path) - from '||l_ut_owner||q'[.ut_suite_cache - where object_owner = :a_object_owner - and object_name = :a_object_name - and name = nvl(:a_procedure_name, name)]' - into l_path using upper(a_object_owner), upper(a_object_name), upper(a_procedure_name); - else - l_path := lower( a_path ); - end if; - l_suite_item_name := case when l_tags.count > 0 then 'suite_items_tags' else 'suite_items' end; - - l_sql := - q'[with - suite_items as ( - 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'[ + return case when not a_skip_all_objects then q'[ and exists ( select 1 from all_objects a where a.object_name = c.object_name - and a.owner = ']'||upper(a_object_owner)||q'[' + and a.owner = '{:object_owner:}' and a.owner = c.object_owner and a.object_type = 'PACKAGE' - )]' end ||q'[ - and c.object_owner = ']'||upper(a_object_owner)||q'[' - and ( ]' || case when l_path is not null then q'[ + )]' else null end; + end; + + function get_path_sql(a_path in varchar2) return varchar2 is + begin + return case when a_path is not null then q'[ :l_path||'.' like c.path || '.%' /*all children and self*/ or ( c.path||'.' like :l_path || '.%' --all parents ]' - else ' :l_path is null and ( :l_path is null ' end - || case when a_object_name is not null - then 'and c.object_name = :a_object_name ' - else 'and :a_object_name is null' end ||' - '|| case when a_procedure_name is not null - then 'and c.name = :a_procedure_name' - else 'and :a_procedure_name is null' end ||q'[ - ) - ) - ),]' - ||case when l_tags.count > 0 then - q'[ - filter_tags as ( + else ' :l_path is null and ( :l_path is null ' end; + end; + + function get_object_name_sql(a_object_name in varchar2) return varchar2 is + begin + return case when a_object_name is not null + then ' c.object_name = :a_object_name ' + else ' :a_object_name is null' end; + end; + + function get_procedure_name_sql(a_procedure_name in varchar2) return varchar2 is + begin + return case when a_procedure_name is not null + then ' c.name = :a_procedure_name' + else ' :a_procedure_name is null' end; + end; + + function get_tags_sql(a_tags_count in integer) return varchar2 is + begin + return case when a_tags_count > 0 then + q'[filter_tags as ( select c.* from suite_items c where c.tags multiset intersect :a_tag_list is not empty @@ -426,60 +470,15 @@ create or replace package body ut_suite_manager is t.path||'.' like c.path || '.%' /*all children and self*/ or c.path||'.' like t.path || '.%' --all parents ) - ),]' + )]' else - q'[dummy as (select 'x' from dual where :a_tag_list is null ),]' - end|| - q'[ suitepaths as ( - select distinct substr(path,1,instr(path,'.',-1)-1) as suitepath, - path, - object_owner - from ]'||l_suite_item_name||q'[ - where self_type = 'UT_SUITE' - ), - gen as ( - select rownum as pos - from xmltable('1 to 20') - ), - suitepath_part AS ( - select distinct - substr(b.suitepath, 1, instr(b.suitepath || '.', '.', 1, g.pos) -1) as path, - object_owner - from suitepaths b - join gen g - on g.pos <= regexp_count(b.suitepath, '\w+') - ), - logical_suite_data as ( - select 'UT_LOGICAL_SUITE' as self_type, p.path, p.object_owner, - upper( substr(p.path, instr( p.path, '.', -1 ) + 1 ) ) as object_name, - cast(null as ]'||l_ut_owner||q'[.ut_executables) as x, - cast(null as ]'||l_ut_owner||q'[.ut_integer_list) as y, - cast(null as ]'||l_ut_owner||q'[.ut_executable_test) as z - from suitepath_part p - where p.path - not in (select s.path from suitepaths s) - ), - logical_suites as ( - select to_number(null) as id, s.self_type, s.path, s.object_owner, s.object_name, - s.object_name as name, null as line_no, null as parse_time, - null as description, null as rollback_type, 0 as disabled_flag, - ]'||l_ut_owner||q'[.ut_varchar2_rows() as warnings, - s.x as before_all_list, s.x as after_all_list, - s.x as before_each_list, s.x as before_test_list, - s.x as after_each_list, s.x as after_test_list, - s.y as expected_error_codes, null as test_tags, - s.z as item - from logical_suite_data s - ), - items as ( - select * from ]'||l_suite_item_name||q'[ - union all - select * from logical_suites - ) - select c.* - from items c - order by c.object_owner,]'|| - case + q'[dummy as (select 'x' from dual where :a_tag_list is null )]' + end; + end; + + function get_random_seed_sql(a_random_seed positive) return varchar2 is + begin + return case when a_random_seed is null then q'[ replace( case @@ -492,10 +491,51 @@ create or replace package body ut_suite_manager is c.line_no, :a_random_seed]' else - l_ut_owner||'.ut_annotation_manager.hash_suite_path( + ' {:owner:}.ut_annotation_manager.hash_suite_path( c.path, :a_random_seed ) desc nulls last' - end; + end; + end; + + function get_cached_suite_data( + a_object_owner varchar2, + a_path varchar2 := null, + a_object_name varchar2 := null, + a_procedure_name varchar2 := null, + a_skip_all_objects boolean := false, + a_random_seed positive, + a_tags ut_varchar2_rows := null + ) return t_cached_suites_cursor is + l_path varchar2( 4000 ); + l_result sys_refcursor; + l_ut_owner varchar2(250) := ut_utils.ut_owner; + l_sql varchar2(32767); + l_suite_item_name varchar2(20); + l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows()); + begin + if a_path is null and a_object_name is not null then + execute immediate 'select min(path) + from '||l_ut_owner||q'[.ut_suite_cache + where object_owner = :a_object_owner + and object_name = :a_object_name + and name = nvl(:a_procedure_name, name)]' + into l_path using upper(a_object_owner), upper(a_object_name), upper(a_procedure_name); + else + l_path := lower( a_path ); + end if; + l_suite_item_name := case when l_tags.count > 0 then 'suite_items_tags' else 'suite_items' end; + + l_sql := gc_get_cache_suite_sql; + l_sql := replace(l_sql,'{:suite_item_name:}',l_suite_item_name); + l_sql := replace(l_sql,'{:object_list:}',get_object_names_sql(a_skip_all_objects)); + l_sql := replace(l_sql,'{:object_owner:}',upper(a_object_owner)); + l_sql := replace(l_sql,'{:path:}',get_path_sql(l_path)); + l_sql := replace(l_sql,'{:object_name:}',get_object_name_sql(a_object_name)); + l_sql := replace(l_sql,'{:procedure_name:}',get_procedure_name_sql(a_procedure_name)); + l_sql := replace(l_sql,'{:tags:}',get_tags_sql(l_tags.count)); + l_sql := replace(l_sql,'{:random_seed:}',get_random_seed_sql(a_random_seed)); + l_sql := replace(l_sql,'{:owner:}',l_ut_owner); + open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tags, a_random_seed; return l_result; end; From effb4202f92c731deb11770861b9089146cf985d Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 6 Jun 2019 00:15:18 +0100 Subject: [PATCH 22/23] Renamed `gc_tag` to `gc_tags` Added debug logging of suite cache query. --- source/core/ut_suite_builder.pkb | 12 ++++++------ source/core/ut_suite_manager.pkb | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index eab4d48b1..295f2d699 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -23,7 +23,7 @@ create or replace package body ut_suite_builder is gc_suite constant t_annotation_name := 'suite'; gc_suitepath constant t_annotation_name := 'suitepath'; - gc_tag constant t_annotation_name := 'tags'; + gc_tags constant t_annotation_name := 'tags'; gc_test constant t_annotation_name := ut_utils.gc_test_execute; gc_disabled constant t_annotation_name := 'disabled'; gc_displayname constant t_annotation_name := 'displayname'; @@ -44,7 +44,7 @@ create or replace package body ut_suite_builder is := tt_annotations( gc_suite, gc_suitepath, - gc_tag, + gc_tags, gc_test, gc_disabled, gc_displayname, @@ -513,8 +513,8 @@ create or replace package body ut_suite_builder is set_seq_no(l_test.after_test_list); end if; - if l_proc_annotations.exists( gc_tag) then - add_tags_to_suite_item(a_suite, l_proc_annotations( gc_tag), l_test.tags, a_procedure_name); + if l_proc_annotations.exists( gc_tags) then + add_tags_to_suite_item(a_suite, l_proc_annotations( gc_tags), l_test.tags, a_procedure_name); end if; if l_proc_annotations.exists( gc_throws) then @@ -667,8 +667,8 @@ create or replace package body ut_suite_builder is l_after_each_list := add_executables( a_suite.object_owner, a_suite.object_name, a_annotations.by_name(gc_aftereach), gc_aftereach ); end if; - if a_annotations.by_name.exists(gc_tag) then - add_tags_to_suite_item(a_suite, a_annotations.by_name(gc_tag),a_suite.tags); + if a_annotations.by_name.exists(gc_tags) then + add_tags_to_suite_item(a_suite, a_annotations.by_name(gc_tags),a_suite.tags); end if; a_suite.disabled_flag := ut_utils.boolean_to_int(a_annotations.by_name.exists(gc_disabled)); diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb index 5dfadea19..3ec25019e 100644 --- a/source/core/ut_suite_manager.pkb +++ b/source/core/ut_suite_manager.pkb @@ -17,7 +17,6 @@ create or replace package body ut_suite_manager is */ gc_suitpath_error_message constant varchar2(100) := 'Suitepath exceeds 1000 CHAR on: '; - gc_tag_errmsg constant integer := 450; gc_get_cache_suite_sql constant varchar2(32767) := q'[with @@ -553,6 +552,8 @@ create or replace package body ut_suite_manager is l_sql := replace(l_sql,'{:random_seed:}',get_random_seed_sql(a_random_seed)); l_sql := replace(l_sql,'{:owner:}',l_ut_owner); + ut_event_manager.trigger_event(ut_event_manager.gc_debug, ut_key_anyvalues().put('l_sql',l_sql) ); + open l_result for l_sql using l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_tags, a_random_seed; return l_result; end; From df67dee7bd56bd47ba568e2cfbd950f04e9cdf62 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Thu, 6 Jun 2019 00:52:27 +0000 Subject: [PATCH 23/23] Updated project version after build [skip ci] --- docs/about/authors.md | 2 +- docs/about/license.md | 2 +- docs/about/project-details.md | 2 +- docs/about/support.md | 2 +- docs/index.md | 2 +- docs/userguide/advanced_data_comparison.md | 2 +- docs/userguide/annotations.md | 2 +- docs/userguide/best-practices.md | 2 +- docs/userguide/coverage.md | 2 +- docs/userguide/exception-reporting.md | 2 +- docs/userguide/expectations.md | 2 +- docs/userguide/getting-started.md | 2 +- docs/userguide/install.md | 2 +- docs/userguide/querying_suites.md | 2 +- docs/userguide/reporters.md | 2 +- docs/userguide/running-unit-tests.md | 2 +- docs/userguide/upgrade.md | 2 +- source/core/ut_utils.pkb | 2 +- source/core/ut_utils.pks | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/about/authors.md b/docs/about/authors.md index c1c945097..ae9d49bd2 100644 --- a/docs/about/authors.md +++ b/docs/about/authors.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) ### utPLSQL v3 Major Contributors diff --git a/docs/about/license.md b/docs/about/license.md index e51ea8f5d..dcd197373 100644 --- a/docs/about/license.md +++ b/docs/about/license.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Version Information diff --git a/docs/about/project-details.md b/docs/about/project-details.md index a4f8ab783..8ed1c349f 100644 --- a/docs/about/project-details.md +++ b/docs/about/project-details.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # utPLSQL Project Details diff --git a/docs/about/support.md b/docs/about/support.md index 9ce66ce5c..983d4206a 100644 --- a/docs/about/support.md +++ b/docs/about/support.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # How to get support diff --git a/docs/index.md b/docs/index.md index 13403f131..a6dd40837 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Introduction to utPLSQL diff --git a/docs/userguide/advanced_data_comparison.md b/docs/userguide/advanced_data_comparison.md index dae921832..d99a62d04 100644 --- a/docs/userguide/advanced_data_comparison.md +++ b/docs/userguide/advanced_data_comparison.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Advanced data comparison diff --git a/docs/userguide/annotations.md b/docs/userguide/annotations.md index 4277ba9cb..416bb2824 100644 --- a/docs/userguide/annotations.md +++ b/docs/userguide/annotations.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Annotations diff --git a/docs/userguide/best-practices.md b/docs/userguide/best-practices.md index 2ba58df80..131e7ccab 100644 --- a/docs/userguide/best-practices.md +++ b/docs/userguide/best-practices.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Best Practices diff --git a/docs/userguide/coverage.md b/docs/userguide/coverage.md index 54d48b06c..841c6b97f 100644 --- a/docs/userguide/coverage.md +++ b/docs/userguide/coverage.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Coverage utPLSQL comes with a built-in coverage reporting engine. The code coverage reporting is based on the DBMS_PROFILER package provided with Oracle database. diff --git a/docs/userguide/exception-reporting.md b/docs/userguide/exception-reporting.md index f42e2f655..b4fac8f14 100644 --- a/docs/userguide/exception-reporting.md +++ b/docs/userguide/exception-reporting.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Exception handling and reporting diff --git a/docs/userguide/expectations.md b/docs/userguide/expectations.md index affa252aa..9162797c1 100644 --- a/docs/userguide/expectations.md +++ b/docs/userguide/expectations.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Expectation concepts Validation of the code under test (the tested logic of procedure/function etc.) is performed by comparing the actual data against the expected data. diff --git a/docs/userguide/getting-started.md b/docs/userguide/getting-started.md index 959902d28..1b0be19b3 100644 --- a/docs/userguide/getting-started.md +++ b/docs/userguide/getting-started.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Getting started with TDD and utPLSQL diff --git a/docs/userguide/install.md b/docs/userguide/install.md index 56eccc064..aa8053e31 100644 --- a/docs/userguide/install.md +++ b/docs/userguide/install.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Downloading latest version of utPLSQL diff --git a/docs/userguide/querying_suites.md b/docs/userguide/querying_suites.md index a412a7c17..0b0ce0759 100644 --- a/docs/userguide/querying_suites.md +++ b/docs/userguide/querying_suites.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Qyerying for test suites diff --git a/docs/userguide/reporters.md b/docs/userguide/reporters.md index c962dc67b..42f9dbc6c 100644 --- a/docs/userguide/reporters.md +++ b/docs/userguide/reporters.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) utPLSQL provides the following reporting formats. diff --git a/docs/userguide/running-unit-tests.md b/docs/userguide/running-unit-tests.md index d25a2d697..c42e2986a 100644 --- a/docs/userguide/running-unit-tests.md +++ b/docs/userguide/running-unit-tests.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Running tests diff --git a/docs/userguide/upgrade.md b/docs/userguide/upgrade.md index db0489a4d..5cbfaa7da 100644 --- a/docs/userguide/upgrade.md +++ b/docs/userguide/upgrade.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-v3.1.7.2999--develop-blue.svg) +![version](https://img.shields.io/badge/version-v3.1.7.3006--develop-blue.svg) # Upgrading from version 2 diff --git a/source/core/ut_utils.pkb b/source/core/ut_utils.pkb index 8e0af7b8d..1557a3981 100644 --- a/source/core/ut_utils.pkb +++ b/source/core/ut_utils.pkb @@ -773,7 +773,7 @@ create or replace package body ut_utils is /** * Change string into unicode to match xmlgen format _00_ * https://docs.oracle.com/en/database/oracle/oracle-database/12.2/adxdb/generation-of-XML-data-from-relational-data.html#GUID-5BE09A7D-80D8-4734-B9AF-4A61F27FA9B2 - * secion v3.1.7.2999-develop + * secion v3.1.7.3006-develop */ function char_to_xmlgen_unicode(a_character varchar2) return varchar2 is begin diff --git a/source/core/ut_utils.pks b/source/core/ut_utils.pks index 28a80be01..41b0f84f7 100644 --- a/source/core/ut_utils.pks +++ b/source/core/ut_utils.pks @@ -21,7 +21,7 @@ create or replace package ut_utils authid definer is * */ - gc_version constant varchar2(50) := 'v3.1.7.2999-develop'; + gc_version constant varchar2(50) := 'v3.1.7.3006-develop'; subtype t_executable_type is varchar2(30); gc_before_all constant t_executable_type := 'beforeall';