';
ut_utils.append_to_list(l_result, l_file_part);
diff --git a/source/reporters/ut_coverage_report_html_helper.pks b/source/reporters/ut_coverage_report_html_helper.pks
index c028168a8..a6dd7eb30 100644
--- a/source/reporters/ut_coverage_report_html_helper.pks
+++ b/source/reporters/ut_coverage_report_html_helper.pks
@@ -1,10 +1,10 @@
-create or replace package ut_coverage_report_html_helper authid current_user is
+create or replace noneditionable package ut_coverage_report_html_helper authid current_user is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -36,7 +36,8 @@ create or replace package ut_coverage_report_html_helper authid current_user is
a_assets_path varchar2,
a_project_name varchar2 := null,
a_command_line varchar2 := null,
- a_charset varchar2 := null
+ a_charset varchar2 := null,
+ a_support_info boolean := true
) return ut_varchar2_rows;
end;
diff --git a/source/reporters/ut_coverage_sonar_reporter.tpb b/source/reporters/ut_coverage_sonar_reporter.tpb
index 8148fc7fc..8eb4c57aa 100644
--- a/source/reporters/ut_coverage_sonar_reporter.tpb
+++ b/source/reporters/ut_coverage_sonar_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_coverage_sonar_reporter is
+create or replace noneditionable type body ut_coverage_sonar_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -103,9 +103,9 @@ create or replace type body ut_coverage_sonar_reporter is
overriding member function get_description return varchar2 as
begin
- return 'Generates a XML coverage report providing information on code coverage with line numbers.' || chr(10) ||
- 'Designed for [SonarQube](https://www.sonarqube.org/) to report coverage.' || chr(10) ||
- 'XML format returned conforms with the Sonar specification: https://docs.sonarqube.org/latest/analysis/generic-test/';
+ return 'Generates an XML coverage report providing information on code coverage with line numbers.
+Designed for [SonarQube](https://www.sonarsource.com/products/sonarqube/) to report coverage.
+XML format returned conforms with the [Sonar specification](https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/test-coverage/generic-test-data).';
end;
end;
diff --git a/source/reporters/ut_coverage_sonar_reporter.tps b/source/reporters/ut_coverage_sonar_reporter.tps
index b5e964a3a..0268fee64 100644
--- a/source/reporters/ut_coverage_sonar_reporter.tps
+++ b/source/reporters/ut_coverage_sonar_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_coverage_sonar_reporter under ut_coverage_reporter_base(
+create or replace noneditionable type ut_coverage_sonar_reporter under ut_coverage_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_coveralls_reporter.tpb b/source/reporters/ut_coveralls_reporter.tpb
deleted file mode 100644
index fc459c906..000000000
--- a/source/reporters/ut_coveralls_reporter.tpb
+++ /dev/null
@@ -1,104 +0,0 @@
-create or replace type body ut_coveralls_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 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_coveralls_reporter(
- self in out nocopy ut_coveralls_reporter
- ) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- return;
- end;
-
- overriding member procedure after_calling_run(self in out nocopy ut_coveralls_reporter, a_run in ut_run) as
-
- function get_lines_json(a_unit_coverage ut_coverage.t_unit_coverage) return ut_varchar2_rows is
- l_file_part varchar2(32767);
- l_result ut_varchar2_rows := ut_varchar2_rows();
- l_last_line_no binary_integer;
- c_coverage_header constant varchar2(30) := '"coverage": [';
- c_null constant varchar2(4) := 'null';
- begin
- ut_utils.append_to_list(l_result, c_coverage_header);
-
- l_last_line_no := a_unit_coverage.lines.last;
- if l_last_line_no is null then
- ut_utils.append_to_list(
- l_result
- , rpad( to_clob( '0' ), ( a_unit_coverage.total_lines * 3 ) - 2, ','||chr(10)||'0' )
- );
- else
- for line_no in 1 .. l_last_line_no loop
- if a_unit_coverage.lines.exists(line_no) then
- l_file_part := to_char(a_unit_coverage.lines(line_no).executions);
- else
- l_file_part := c_null;
- end if;
- if line_no < l_last_line_no then
- l_file_part := l_file_part ||',';
- end if;
- ut_utils.append_to_list(l_result, l_file_part);
- end loop;
- end if;
- ut_utils.append_to_list(l_result, ']');
- return l_result;
- end;
-
- function get_coverage_json(
- a_coverage_data ut_coverage.t_coverage
- ) return ut_varchar2_rows is
- l_result ut_varchar2_rows := ut_varchar2_rows();
- l_unit ut_coverage.t_object_name;
- c_coverage_header constant varchar2(30) := '{"source_files":[';
- c_coverage_footer constant varchar2(30) := ']}'||chr(10)||' ';
- begin
- ut_utils.append_to_list(l_result, c_coverage_header);
- l_unit := a_coverage_data.objects.first;
- while l_unit is not null loop
- ut_utils.append_to_list(l_result, '{ "name": "'||l_unit||'",');
-
- ut_utils.append_to_list(l_result,get_lines_json(a_coverage_data.objects(l_unit)));
-
- ut_utils.append_to_list(l_result, '}');
-
- l_unit := a_coverage_data.objects.next(l_unit);
- if l_unit is not null then
- ut_utils.append_to_list(l_result, ',');
- end if;
- end loop;
- ut_utils.append_to_list(l_result, c_coverage_footer);
- return l_result;
- end;
- begin
- ut_coverage.coverage_stop();
-
- self.print_text_lines(
- get_coverage_json(
- ut_coverage.get_coverage_data(a_run.coverage_options)
- )
- );
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Generates a JSON coverage report providing information on code coverage with line numbers.' || chr(10) ||
- 'Designed for [Coveralls](https://coveralls.io/).' || chr(10) ||
- 'JSON format conforms with specification: https://docs.coveralls.io/api-introduction';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_coveralls_reporter.tps b/source/reporters/ut_coveralls_reporter.tps
deleted file mode 100644
index e547793d1..000000000
--- a/source/reporters/ut_coveralls_reporter.tps
+++ /dev/null
@@ -1,31 +0,0 @@
-create or replace type ut_coveralls_reporter under ut_coverage_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2026 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.
- */
-
- /**
- * Builds a coverage XML report that follows rules described in
- * https://docs.coveralls.io/api-introduction
- */
- constructor function ut_coveralls_reporter(
- self in out nocopy ut_coveralls_reporter
- ) return self as result,
-
- overriding member procedure after_calling_run(self in out nocopy ut_coveralls_reporter, a_run in ut_run),
-
- overriding member function get_description return varchar2
-)
-/
diff --git a/source/reporters/ut_debug_reporter.tpb b/source/reporters/ut_debug_reporter.tpb
index b17f039ea..a2b797021 100644
--- a/source/reporters/ut_debug_reporter.tpb
+++ b/source/reporters/ut_debug_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_debug_reporter is
+create or replace noneditionable type body ut_debug_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_debug_reporter.tps b/source/reporters/ut_debug_reporter.tps
index 85c0eeb54..26e42cbc4 100644
--- a/source/reporters/ut_debug_reporter.tps
+++ b/source/reporters/ut_debug_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_debug_reporter under ut_output_reporter_base(
+create or replace noneditionable type ut_debug_reporter under ut_output_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_documentation_reporter.tpb b/source/reporters/ut_documentation_reporter.tpb
index 489b6efd2..ad3d1fb69 100644
--- a/source/reporters/ut_documentation_reporter.tpb
+++ b/source/reporters/ut_documentation_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_documentation_reporter is
+create or replace noneditionable type body ut_documentation_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -216,13 +216,16 @@ create or replace type body ut_documentation_reporter is
if a_run.random_test_order_seed is not null then
self.print_text('Tests were executed with random order seed '''||a_run.random_test_order_seed||'''.');
end if;
+ if a_run.get_support_info_flag() then
+ self.print_cyan_text(ut_utils.gc_support_text || ': ' || ut_utils.gc_support_url);
+ end if;
self.print_text(' ');
(self as ut_reporter_base).after_calling_run(a_run);
end;
overriding member function get_description return varchar2 as
begin
- return 'A textual pretty-print of unit test results (usually use for console output)';
+ return 'Creates a textual, pretty-print, human-readable report mirroring the suite hierarchy. Used for console runs, interactive development and log review.';
end;
end;
diff --git a/source/reporters/ut_documentation_reporter.tps b/source/reporters/ut_documentation_reporter.tps
index 23b86226f..52a7911ce 100644
--- a/source/reporters/ut_documentation_reporter.tps
+++ b/source/reporters/ut_documentation_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_documentation_reporter under ut_console_reporter_base(
+create or replace noneditionable type ut_documentation_reporter under ut_console_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_junit_reporter.tpb b/source/reporters/ut_junit_reporter.tpb
index a2cffd287..e7741926d 100644
--- a/source/reporters/ut_junit_reporter.tpb
+++ b/source/reporters/ut_junit_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_junit_reporter is
+create or replace noneditionable type body ut_junit_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_junit_reporter.tps b/source/reporters/ut_junit_reporter.tps
index 5999c33f5..88292acbb 100644
--- a/source/reporters/ut_junit_reporter.tps
+++ b/source/reporters/ut_junit_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_junit_reporter force under ut_output_reporter_base(
+create or replace noneditionable type ut_junit_reporter force under ut_output_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_realtime_reporter.tpb b/source/reporters/ut_realtime_reporter.tpb
index fac7cd9b8..b0ec5d2e2 100644
--- a/source/reporters/ut_realtime_reporter.tpb
+++ b/source/reporters/ut_realtime_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_realtime_reporter is
+create or replace noneditionable type body ut_realtime_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -204,11 +204,6 @@ create or replace type body ut_realtime_reporter is
self.flush_print_buffer('post-test');
end after_calling_test;
- overriding member function get_description return varchar2 is
- begin
- return 'Provides test results in a XML format, for clients such as SQL Developer interested in showing progressing details.';
- end get_description;
-
member procedure print_start_node(
self in out nocopy ut_realtime_reporter,
a_node_name in varchar2,
@@ -284,5 +279,10 @@ create or replace type body ut_realtime_reporter is
print_buffer.delete;
end flush_print_buffer;
+ overriding member function get_description return varchar2 is
+ begin
+ return 'Provides live test execution progress that can be consumed from another session, enabling clients such as SQL Developer to show progress in real time as tests run.';
+ end get_description;
+
end;
/
diff --git a/source/reporters/ut_realtime_reporter.tps b/source/reporters/ut_realtime_reporter.tps
index 5ab350162..7efdd1bb3 100644
--- a/source/reporters/ut_realtime_reporter.tps
+++ b/source/reporters/ut_realtime_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_realtime_reporter force under ut_output_reporter_base(
+create or replace noneditionable type ut_realtime_reporter force under ut_output_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_sonar_test_reporter.tpb b/source/reporters/ut_sonar_test_reporter.tpb
index dfa6a7421..6b8003ecb 100644
--- a/source/reporters/ut_sonar_test_reporter.tpb
+++ b/source/reporters/ut_sonar_test_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_sonar_test_reporter is
+create or replace noneditionable type body ut_sonar_test_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -106,9 +106,9 @@ create or replace type body ut_sonar_test_reporter is
overriding member function get_description return varchar2 as
begin
- return 'Generates a XML report providing detailed information on test execution.' || chr(10) ||
- 'Designed for [SonarQube](https://www.sonarqube.org/) to report test execution.' || chr(10) ||
- 'XML format returned conforms with the Sonar specification: https://docs.sonarqube.org/latest/analysis/generic-test/';
+ return 'Generates an XML report providing detailed information on test execution.
+Designed for [SonarQube](https://www.sonarsource.com/products/sonarqube/) to report test execution.
+XML format returned conforms with the [Sonar specification](https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/test-coverage/generic-test-data).';
end;
end;
diff --git a/source/reporters/ut_sonar_test_reporter.tps b/source/reporters/ut_sonar_test_reporter.tps
index d9f98071d..f7f5aeb39 100644
--- a/source/reporters/ut_sonar_test_reporter.tps
+++ b/source/reporters/ut_sonar_test_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_sonar_test_reporter under ut_output_reporter_base(
+create or replace noneditionable type ut_sonar_test_reporter under ut_output_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_tap_reporter.tpb b/source/reporters/ut_tap_reporter.tpb
index 02246b97e..e1b3b617d 100644
--- a/source/reporters/ut_tap_reporter.tpb
+++ b/source/reporters/ut_tap_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_tap_reporter is
+create or replace noneditionable type body ut_tap_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -25,7 +25,7 @@ create or replace type body ut_tap_reporter is
member procedure print_comment(self in out nocopy ut_tap_reporter, a_comment clob) as
begin
- self.print_clob(regexp_replace(a_comment, '^', '# ', 1, 0, 'm'));
+ self.print_clob(regexp_replace(a_comment, '^(.+)', '# \1', 1, 0, 'm'));
end print_comment;
member function escape_special_chars(self in out nocopy ut_tap_reporter, a_string_to_escape clob) return clob as
@@ -134,6 +134,9 @@ create or replace type body ut_tap_reporter is
overriding member procedure after_calling_run(self in out nocopy ut_tap_reporter, a_run in ut_run) as
begin
self.lvl := 0;
+ if a_run.get_support_info_flag() then
+ self.print_comment(ut_utils.gc_support_text || ': ' || ut_utils.gc_support_url);
+ end if;
end;
end;
/
diff --git a/source/reporters/ut_tap_reporter.tps b/source/reporters/ut_tap_reporter.tps
index 94423b6fc..127256cf8 100644
--- a/source/reporters/ut_tap_reporter.tps
+++ b/source/reporters/ut_tap_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_tap_reporter under ut_documentation_reporter(
+create or replace noneditionable type ut_tap_reporter under ut_documentation_reporter(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_teamcity_reporter.tpb b/source/reporters/ut_teamcity_reporter.tpb
index 2e09c7103..2e76e3e3f 100644
--- a/source/reporters/ut_teamcity_reporter.tpb
+++ b/source/reporters/ut_teamcity_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_teamcity_reporter is
+create or replace noneditionable type body ut_teamcity_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_teamcity_reporter.tps b/source/reporters/ut_teamcity_reporter.tps
index e5c43b59e..e70ad4a4b 100644
--- a/source/reporters/ut_teamcity_reporter.tps
+++ b/source/reporters/ut_teamcity_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_teamcity_reporter under ut_output_reporter_base(
+create or replace noneditionable type ut_teamcity_reporter under ut_output_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_teamcity_reporter_helper.pkb b/source/reporters/ut_teamcity_reporter_helper.pkb
index 575af645d..ac9d4b567 100644
--- a/source/reporters/ut_teamcity_reporter_helper.pkb
+++ b/source/reporters/ut_teamcity_reporter_helper.pkb
@@ -1,10 +1,10 @@
-create or replace package body ut_teamcity_reporter_helper is
+create or replace noneditionable package body ut_teamcity_reporter_helper is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_teamcity_reporter_helper.pks b/source/reporters/ut_teamcity_reporter_helper.pks
index 727d02913..03c655c33 100644
--- a/source/reporters/ut_teamcity_reporter_helper.pks
+++ b/source/reporters/ut_teamcity_reporter_helper.pks
@@ -1,10 +1,10 @@
-create or replace package ut_teamcity_reporter_helper is
+create or replace noneditionable package ut_teamcity_reporter_helper is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_tfs_junit_reporter.tpb b/source/reporters/ut_tfs_junit_reporter.tpb
index 8c2bd6333..38aa41bfa 100644
--- a/source/reporters/ut_tfs_junit_reporter.tpb
+++ b/source/reporters/ut_tfs_junit_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_tfs_junit_reporter is
+create or replace noneditionable type body ut_tfs_junit_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -171,9 +171,9 @@ create or replace type body ut_tfs_junit_reporter is
overriding member function get_description return varchar2 as
begin
- return 'Provides outcomes in a format conforming with JUnit version for TFS / VSTS.
- As defined by specs :https://docs.microsoft.com/en-us/vsts/build-release/tasks/test/publish-test-results?view=vsts
- Version is based on windy road junit https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd.';
+ return 'Provides outcomes in a format conforming with JUnit version for TFS / VSTS
+as defined by [specification](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/publish-test-results-v2?view=azure-pipelines)
+The implementation is based on [windyroad junit schema](https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd).';
end;
end;
diff --git a/source/reporters/ut_tfs_junit_reporter.tps b/source/reporters/ut_tfs_junit_reporter.tps
index 3af2226a5..3212085ea 100644
--- a/source/reporters/ut_tfs_junit_reporter.tps
+++ b/source/reporters/ut_tfs_junit_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_tfs_junit_reporter under ut_output_reporter_base(
+create or replace noneditionable type ut_tfs_junit_reporter under ut_output_reporter_base(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_xunit_reporter.tpb b/source/reporters/ut_xunit_reporter.tpb
index 164703917..4b6007994 100644
--- a/source/reporters/ut_xunit_reporter.tpb
+++ b/source/reporters/ut_xunit_reporter.tpb
@@ -1,10 +1,10 @@
-create or replace type body ut_xunit_reporter is
+create or replace noneditionable type body ut_xunit_reporter is
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/reporters/ut_xunit_reporter.tps b/source/reporters/ut_xunit_reporter.tps
index 970e4d162..2e7a84f95 100644
--- a/source/reporters/ut_xunit_reporter.tps
+++ b/source/reporters/ut_xunit_reporter.tps
@@ -1,10 +1,10 @@
-create or replace type ut_xunit_reporter under ut_junit_reporter(
+create or replace noneditionable type ut_xunit_reporter under ut_junit_reporter(
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/set_install_params.sql b/source/set_install_params.sql
index b559b8023..1d58ab09a 100644
--- a/source/set_install_params.sql
+++ b/source/set_install_params.sql
@@ -2,8 +2,8 @@
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/uninstall.sql b/source/uninstall.sql
index 712845fb7..ba1582844 100644
--- a/source/uninstall.sql
+++ b/source/uninstall.sql
@@ -2,8 +2,8 @@
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/uninstall_all.sql b/source/uninstall_all.sql
index d3d3f3fbe..af94716c1 100644
--- a/source/uninstall_all.sql
+++ b/source/uninstall_all.sql
@@ -2,8 +2,8 @@
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/uninstall_coverage_tables.sql b/source/uninstall_coverage_tables.sql
index df3c19627..6912330ae 100644
--- a/source/uninstall_coverage_tables.sql
+++ b/source/uninstall_coverage_tables.sql
@@ -2,8 +2,8 @@
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
diff --git a/source/uninstall_objects.sql b/source/uninstall_objects.sql
index 8ef644aa9..5c6e41dc3 100644
--- a/source/uninstall_objects.sql
+++ b/source/uninstall_objects.sql
@@ -2,8 +2,8 @@
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -74,8 +74,6 @@ drop synonym be_within;
drop synonym be_within_pct;
-drop type ut_coveralls_reporter force;
-
drop type ut_coverage_sonar_reporter force;
drop type ut_coverage_cobertura_reporter force;
@@ -116,6 +114,8 @@ drop package ut_suite_tag_filter;
drop package ut_suite_cache_manager;
+drop package ut_suite_cache_macros;
+
drop table ut_suite_cache purge;
drop type ut_suite_cache_rows force;
@@ -242,6 +242,8 @@ drop package ut_annotation_parser;
drop package ut_annotation_cache_manager;
+drop package ut_annotation_cache_macros;
+
drop table ut_annotation_cache cascade constraints purge;
drop table ut_annotation_cache_info cascade constraints purge;
@@ -275,12 +277,6 @@ begin
$if dbms_db_version.version < 21 $then
begin execute immediate 'drop type json force'; exception when others then null; end;
$end
- $if dbms_db_version.version = 12 and dbms_db_version.release = 1 or dbms_db_version.version < 12 $then
- begin execute immediate 'drop type json_element_t force'; exception when others then null; end;
- begin execute immediate 'drop type json_object_t force'; exception when others then null; end;
- begin execute immediate 'drop type json_array_t force'; exception when others then null; end;
- begin execute immediate 'drop type json_key_list force'; exception when others then null; end;
- $end
end;
/
@@ -419,7 +415,7 @@ set feedback off
declare
i integer := 0;
begin
- dbms_output.put_line('Dropping packages created for 12.2+ ' || upper('&&ut3_owner'));
+ dbms_output.put_line('Dropping block coverage packages ' || upper('&&ut3_owner'));
for pkg in (
select object_name, owner
from all_objects
@@ -446,3 +442,15 @@ begin
dbms_output.put_line(i || ' packages dropped');
end;
/
+
+declare
+ e_role_not_exists exception;
+ pragma exception_init(e_role_not_exists, -1919);
+begin
+ execute immediate 'drop role &&ut3_owner._cbac_modify_objects_role';
+ dbms_output.put_line('Role ' || upper('&&ut3_owner._cbac_modify_objects_role') || ' dropped');
+exception
+ when e_role_not_exists then
+ dbms_output.put_line('Role ' || upper('&&ut3_owner._cbac_modify_objects_role') || ' does not exist');
+end;
+/
diff --git a/source/uninstall_synonyms.sql b/source/uninstall_synonyms.sql
index 4a12340f6..783ac51e8 100644
--- a/source/uninstall_synonyms.sql
+++ b/source/uninstall_synonyms.sql
@@ -2,8 +2,8 @@
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
+ 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
@@ -49,7 +49,7 @@ end;
declare
i integer := 0;
begin
- dbms_output.put_line('Dropping synonyms pointing to PL/SQL code coverage objects on 12.2 ' || upper('&&ut3_owner'));
+ dbms_output.put_line('Dropping synonyms pointing to PL/SQL code coverage objects ' || upper('&&ut3_owner'));
for syn in (
select
case when owner = 'PUBLIC' then 'public synonym '
diff --git a/source/ut3_cbac_modify_objects_role_grants.sql b/source/ut3_cbac_modify_objects_role_grants.sql
new file mode 100644
index 000000000..b8748c46a
--- /dev/null
+++ b/source/ut3_cbac_modify_objects_role_grants.sql
@@ -0,0 +1,62 @@
+/*
+ utPLSQL - Version 3
+ Copyright 2016 - 2026 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.
+
+ Code based access control for the invoker rights packages ut_annotation_cache_manager, ut_annotation_manager,
+ ut_suite_cache_manager and ut_suite_manager.
+ The packages access the annotation and suite cache tables through the role
_cbac_modify_objects_role,
+ directly or through the SQL macros of ut_annotation_cache_macros and ut_suite_cache_macros,
+ so the users calling the framework do not need any privileges on those tables.
+ The types and packages used in SQL statements of those packages are granted to the role too,
+ so they do not need to be granted to the users calling the framework.
+*/
+
+prompt Granting privileges to role &&ut3_owner._cbac_modify_objects_role
+
+--annotation cache
+grant select, insert, update, delete on &&ut3_owner..ut_annotation_cache to &&ut3_owner._cbac_modify_objects_role;
+grant select, insert, update, delete on &&ut3_owner..ut_annotation_cache_info to &&ut3_owner._cbac_modify_objects_role;
+grant select, insert, update, delete on &&ut3_owner..ut_annotation_cache_schema to &&ut3_owner._cbac_modify_objects_role;
+grant select on &&ut3_owner..ut_annotation_cache_seq to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_annotated_object to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_annotation to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_annotations to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_annotation_cache_macros to &&ut3_owner._cbac_modify_objects_role;
+
+--suite cache
+grant select, insert, update, delete on &&ut3_owner..ut_suite_cache to &&ut3_owner._cbac_modify_objects_role;
+grant select, insert, update, delete on &&ut3_owner..ut_suite_cache_package to &&ut3_owner._cbac_modify_objects_role;
+grant select, insert, update, delete on &&ut3_owner..ut_suite_cache_schema to &&ut3_owner._cbac_modify_objects_role;
+grant select on &&ut3_owner..ut_suite_cache_seq to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_suite_cache_row to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_suite_item_info to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_suite to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_test to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_executables to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_executable_test to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_varchar2_rows to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_integer_list to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_path_item to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_object_name to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_utils to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_suite_tag_filter to &&ut3_owner._cbac_modify_objects_role;
+grant execute on &&ut3_owner..ut_suite_cache_macros to &&ut3_owner._cbac_modify_objects_role;
+
+grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_annotation_cache_manager;
+grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_annotation_manager;
+grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_suite_cache_manager;
+grant &&ut3_owner._cbac_modify_objects_role to package &&ut3_owner..ut_suite_manager;
+
diff --git a/test/install_above_12_1.sql b/test/install_above_12_1.sql
deleted file mode 100644
index fe20cf816..000000000
--- a/test/install_above_12_1.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-set termout off
-set echo off
-spool dummy.sql
-prompt whenever sqlerror exit failure rollback
-spool off
-
-
-def FILE_NAME = '&&1'
-column SCRIPT_NAME new_value SCRIPT_NAME noprint
-
-VAR V_FILE_NAME VARCHAR2(1000);
-begin
- if dbms_db_version.version = 12 and dbms_db_version.release >= 2
- or dbms_db_version.version > 12
- then
- :V_FILE_NAME := '&&FILE_NAME';
- else
- :V_FILE_NAME := 'dummy.sql';
- end if;
-end;
-/
-set verify off
-select :V_FILE_NAME as SCRIPT_NAME from dual;
-set termout on
-
-
-@@&&SCRIPT_NAME
-
diff --git a/test/install_and_run_tests.sh b/test/install_and_run_tests.sh
index 0c17b08b7..24932d663 100755
--- a/test/install_and_run_tests.sh
+++ b/test/install_and_run_tests.sh
@@ -1,9 +1,10 @@
#!/bin/bash
-set -ev
+set -e
#goto git root directory
-git rev-parse && cd "$(git rev-parse --show-cdup)"
+git rev-parse && cd "$(git rev-parse --show-toplevel)"
. ./development/env.sh
+set -v
cd test
time . ./install_tests.sh
diff --git a/test/install_below_12_2.sql b/test/install_below_12_2.sql
deleted file mode 100644
index 669ae75fc..000000000
--- a/test/install_below_12_2.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-set termout off
-set echo off
-spool dummy.sql
-prompt whenever sqlerror exit failure rollback
-spool off
-
-
-def FILE_NAME = '&&1'
-column SCRIPT_NAME new_value SCRIPT_NAME noprint
-
-VAR V_FILE_NAME VARCHAR2(1000);
-begin
- if dbms_db_version.version = 12 and dbms_db_version.release < 2
- or dbms_db_version.version < 12
- then
- :V_FILE_NAME := '&&FILE_NAME';
- else
- :V_FILE_NAME := 'dummy.sql';
- end if;
-end;
-/
-set verify off
-select :V_FILE_NAME as SCRIPT_NAME from dual;
-set termout on
-
-
-@@&&SCRIPT_NAME
-
diff --git a/test/install_ut3_tester_tests.sql b/test/install_ut3_tester_tests.sql
index cc96b2b64..fa1331e00 100644
--- a/test/install_ut3_tester_tests.sql
+++ b/test/install_ut3_tester_tests.sql
@@ -25,6 +25,8 @@ alter session set plsql_optimize_level=0;
@@ut3_tester/core/test_file_mapper.pks
@@ut3_tester/core/test_output_buffer.pks
@@ut3_tester/core/test_suite_builder.pks
+@@ut3_tester/core/test_ut_metadata.pks
+@@ut3_tester/core/test_coverage_report_html_helper.pks
@@ut3_tester/core.pkb
@@ -44,6 +46,8 @@ alter session set plsql_optimize_level=0;
@@ut3_tester/core/test_file_mapper.pkb
@@ut3_tester/core/test_output_buffer.pkb
@@ut3_tester/core/test_suite_builder.pkb
+@@ut3_tester/core/test_ut_metadata.pkb
+@@ut3_tester/core/test_coverage_report_html_helper.pkb
diff --git a/test/install_ut3_user_tests.sql b/test/install_ut3_user_tests.sql
index 518e07841..36966b3f6 100644
--- a/test/install_ut3_user_tests.sql
+++ b/test/install_ut3_user_tests.sql
@@ -30,9 +30,7 @@ prompt Install user tests
@@ut3_user/expectations/test_matchers.pks
@@ut3_user/expectations/test_expectation_anydata.pks
@@ut3_user/expectations/test_expectations_cursor.pks
-set define on
-@@install_above_12_1.sql 'ut3_user/expectations/test_expectations_json.pks'
-set define off
+@@ut3_user/expectations/test_expectations_json.pks
@@ut3_user/api/test_ut_runner.pks
@@ut3_user/api/test_ut_run.pks
@@ut3_user/reporters.pks
@@ -50,7 +48,6 @@ set define on
@@ut3_user/reporters/test_coverage/test_extended_coverage.pks
@@ut3_user/reporters/test_coverage/test_html_coverage_reporter.pks
set define off
-@@ut3_user/reporters/test_coverage/test_coveralls_reporter.pks
@@ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pks
@@ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pks
set define on
@@ -74,9 +71,7 @@ set define off
@@ut3_user/expectations/test_matchers.pkb
@@ut3_user/expectations/test_expectation_anydata.pkb
@@ut3_user/expectations/test_expectations_cursor.pkb
-set define on
-@@install_above_12_1.sql 'ut3_user/expectations/test_expectations_json.pkb'
-set define off
+@@ut3_user/expectations/test_expectations_json.pkb
@@ut3_user/api/test_ut_runner.pkb
@@ut3_user/api/test_ut_run.pkb
@@ut3_user/reporters.pkb
@@ -93,7 +88,6 @@ set define on
@@ut3_user/reporters/test_coverage/test_extended_coverage.pkb
@@ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb
set define off
-@@ut3_user/reporters/test_coverage/test_coveralls_reporter.pkb
@@ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb
@@ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb
set define on
diff --git a/test/run_tests.sh b/test/run_tests.sh
index 7d0431aec..1a6970283 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -2,7 +2,7 @@
set -ev
#goto git root directory
-git rev-parse && cd "$(git rev-parse --show-cdup)"
+git rev-parse && cd "$(git rev-parse --show-toplevel)"
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
@@ -17,7 +17,6 @@ time utPLSQL-cli/bin/utplsql run UT3_TESTER_HELPER/ut3@//${CONNECTION_STR} -D \
-f=ut_coverage_sonar_reporter -o=coverage.xml \
-f=ut_coverage_cobertura_reporter -o=cobertura.xml \
-f=ut_coverage_html_reporter -o=coverage.html \
--f=ut_coveralls_reporter -o=coverage.json \
-f=ut_sonar_test_reporter -o=test_results.xml \
-f=ut_junit_reporter -o=junit_test_results.xml \
-f=ut_tfs_junit_reporter -o=tfs_test_results.xml \
diff --git a/test/ut3_tester/core/annotations/test_annot_throws_exception.pkb b/test/ut3_tester/core/annotations/test_annot_throws_exception.pkb
index ac51d3a49..761377765 100644
--- a/test/ut3_tester/core/annotations/test_annot_throws_exception.pkb
+++ b/test/ut3_tester/core/annotations/test_annot_throws_exception.pkb
@@ -1,6 +1,7 @@
create or replace package body test_annot_throws_exception
is
g_tests_results clob;
+ g_results_other_schema clob;
procedure recollect_tests_results is
pragma autonomous_transaction;
@@ -25,10 +26,18 @@ is
e_some_exception exception;
pragma exception_init(e_some_exception, -20207);
- end;]';
+ end;
+ ]';
- l_package_spec := '
- create package annotated_package_with_throws is
+ l_package_spec := q'[
+ create or replace package annotated_package_with_throws is
+
+ c_local_error_no constant number := -20211;
+ e_some_local_exception exception;
+ pragma exception_init(e_some_local_exception, -20212);
+
+ e_uninitialized_exception_variable exception;
+
--%suite(Dummy package to test annotation throws)
--%test(Throws same annotated exception)
@@ -95,6 +104,22 @@ is
--%throws(exc_pkg.c_e_mix_missin,utter_rubbish)
procedure mixed_list_notexi;
+ --%test(Success referencing an exception variable when running from another schema)
+ --%throws(exc_pkg.e_some_exception)
+ procedure named_exc_pragma_run_from_another_schema;
+
+ --%test(Success referencing a numeric exception variable when running from another schema)
+ --%throws(exc_pkg.c_e_list_1)
+ procedure exc_number_var_run_from_another_schema;
+
+ --%test(Success referencing an exception variable without package name when running from another schema)
+ --%throws(e_some_local_exception)
+ procedure named_exc_pragma_run_from_another_schema_no_package_name;
+
+ --%test(Success referencing a numeric exception variable without package name when running from another schema)
+ --%throws(c_local_error_no)
+ procedure exc_number_var_run_from_another_schema_no_package_name;
+
--%test(Success resolve and match named exception defined in pragma exception init)
--%throws(exc_pkg.e_some_exception)
procedure named_exc_pragma;
@@ -122,11 +147,20 @@ is
--%test(Bad exception constant)
--%throws(exc_pkg.c_e_dummy);
procedure bad_exc_const;
+
+ --%test(Uninitialized exception variable can be used successfully in a test)
+ --%throws(e_uninitialized_exception_variable)
+ procedure referencing_uninitialized_exception;
+
+ --%test(Failure report shows all expected exceptions)
+ --%throws(c_local_error_no,e_some_local_exception,e_uninitialized_exception_variable)
+ procedure not_throwing_expected_exceptions;
+
end;
- ';
+ ]';
l_package_body := '
- create package body annotated_package_with_throws is
+ create or replace package body annotated_package_with_throws is
procedure raised_same_exception is
begin
raise_application_error(-20145, ''Test error'');
@@ -208,6 +242,26 @@ is
raise_application_error(exc_pkg.c_e_mix_missin,''Test'');
end;
+ procedure named_exc_pragma_run_from_another_schema is
+ begin
+ raise exc_pkg.e_some_exception;
+ end;
+
+ procedure exc_number_var_run_from_another_schema is
+ begin
+ raise_application_error(exc_pkg.c_e_list_1,''Test'');
+ end;
+
+ procedure named_exc_pragma_run_from_another_schema_no_package_name is
+ begin
+ raise e_some_local_exception;
+ end;
+
+ procedure exc_number_var_run_from_another_schema_no_package_name is
+ begin
+ raise_application_error(c_local_error_no,''Test'');
+ end;
+
procedure named_exc_pragma is
begin
raise exc_pkg.e_some_exception;
@@ -243,6 +297,15 @@ is
raise_application_error(-20143, ''Test error'');
end;
+ procedure referencing_uninitialized_exception is
+ begin
+ raise e_uninitialized_exception_variable;
+ end;
+
+ procedure not_throwing_expected_exceptions is
+ begin
+ raise_application_error(-20143, ''Test error'');
+ end;
end;
';
@@ -256,6 +319,14 @@ is
g_tests_results := ut3_develop.ut_utils.table_to_clob(l_test_results);
end;
+ procedure drop_test_package is
+ pragma autonomous_transaction;
+ begin
+ execute immediate 'drop package annotated_package_with_throws';
+ execute immediate 'drop package exc_pkg';
+ end;
+
+
procedure throws_same_annotated_except is
begin
ut.expect(g_tests_results).to_match('^\s*Throws same annotated exception \[[,\.0-9]+ sec\]\s*$','m');
@@ -312,7 +383,7 @@ is
procedure one_valid_exception_number is
begin
- ut.expect(g_tests_results).to_match('^\s*Detects a valid exception number within many invalid ones \[[\.0-9]+ sec\]\s*$','m');
+ ut.expect(g_tests_results).to_match('^\s*Detects a valid exception number within many invalid ones \[[,\.0-9]+ sec\]\s*$','m');
ut.expect(g_tests_results).to_match('one_valid_exception_number\s*Invalid parameter value ".*" for "--%throws" annotation. Parameter ignored.','m');
end;
@@ -357,7 +428,37 @@ is
ut.expect(g_tests_results).to_match('^\s*Success resolve and match named exception defined in pragma exception init \[[,\.0-9]+ sec\]\s*$','m');
ut.expect(g_tests_results).not_to_match('named_exc_pragma');
end;
-
+
+ procedure run_from_another_schema is
+ begin
+ ut3_tester_helper.run_helper.run(('ut3_tester.annotated_package_with_throws'));
+ g_results_other_schema := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
+ end;
+
+ procedure named_exc_pragma_run_from_another_schema is
+ begin
+ ut.expect(g_results_other_schema).to_match('^\s*Success referencing an exception variable when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
+ ut.expect(g_results_other_schema).not_to_match('named_exc_pragma_run_from_another_schema');
+ end;
+
+ procedure named_exc_pragma_run_from_another_schema_no_package_name is
+ begin
+ ut.expect(g_results_other_schema).to_match('^\s*Success referencing an exception variable without package name when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
+ ut.expect(g_results_other_schema).not_to_match('named_exc_pragma_run_from_another_schema_no_package_name');
+ end;
+
+ procedure exc_number_var_run_from_another_schema_no_package_name is
+ begin
+ ut.expect(g_results_other_schema).to_match('^\s*Success referencing a numeric exception variable without package name when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
+ ut.expect(g_results_other_schema).not_to_match('exc_number_var_run_from_another_schema_no_package_name');
+ end;
+
+ procedure exc_number_var_run_from_another_schema is
+ begin
+ ut.expect(g_results_other_schema).to_match('^\s*Success referencing a numeric exception variable when running from another schema \[[,\.0-9]+ sec\]\s*$', 'm');
+ ut.expect(g_results_other_schema).not_to_match('exc_number_var_run_from_another_schema');
+ end;
+
procedure named_exc_ora is
begin
ut.expect(g_tests_results).to_match('^\s*Success resolve and match oracle named exception \[[,\.0-9]+ sec\]\s*$','m');
@@ -392,13 +493,23 @@ is
begin
ut.expect(g_tests_results).to_match('^\s*Bad exception constant \[[,\.0-9]+ sec\] \(FAILED - [0-9]+\)\s*$','m');
ut.expect(g_tests_results).to_match('bad_exc_const\s*ORA-20143: Test error\s*ORA-06512: at "UT3_TESTER.ANNOTATED_PACKAGE_WITH_THROWS"');
- end;
-
- procedure drop_test_package is
- pragma autonomous_transaction;
+ end;
+
+ procedure referencing_uninitialized_exception is
+ l_test_results ut3_develop.ut_varchar2_list;
+ l_actual clob;
begin
- execute immediate 'drop package annotated_package_with_throws';
- execute immediate 'drop package exc_pkg';
+ select * bulk collect into l_test_results from table(ut3_develop.ut.run(('annotated_package_with_throws.referencing_uninitialized_exception')));
+
+ l_actual := ut3_develop.ut_utils.table_to_clob(l_test_results);
+ ut.expect(l_actual).to_match('^\s*Uninitialized exception variable can be used successfully in a test \[[,\.0-9]+ sec\]\s*$','m');
+ ut.expect(l_actual).not_to_match('referencing_uninitialized_exception');
+ end;
+
+ procedure not_throwing_expected_exceptions is
+ begin
+ ut.expect(g_tests_results).to_match('not_throwing_expected_exceptions');
+ ut.expect(g_tests_results).to_match('Actual: -20143 was expected to be one of: \(annotated_package_with_throws.e_some_local_exception, annotated_package_with_throws.e_uninitialized_exception_variable, -20211\)');
end;
end;
diff --git a/test/ut3_tester/core/annotations/test_annot_throws_exception.pks b/test/ut3_tester/core/annotations/test_annot_throws_exception.pks
index a9d20183d..a41c18d2b 100644
--- a/test/ut3_tester/core/annotations/test_annot_throws_exception.pks
+++ b/test/ut3_tester/core/annotations/test_annot_throws_exception.pks
@@ -5,7 +5,11 @@ is
--%beforeall
procedure recollect_tests_results;
-
+
+ --%afterall
+ procedure drop_test_package;
+
+
--%test(Gives success when annotated number exception is thrown)
procedure throws_same_annotated_except;
@@ -18,7 +22,7 @@ is
--%test(Gives failure when the raised exception is different that the annotated one)
procedure throws_diff_annotated_except;
- --%test(Ignores when the annotation throws is empty)
+ --%test(Ignores the throws annotation when it is empty)
procedure throws_empty;
--%test(Ignores when only bad parameters are passed, the test raise a exception and it shows errored test)
@@ -36,7 +40,7 @@ is
--%test(Detects a valid exception number within many invalid ones)
procedure one_valid_exception_number;
- --%test(Gives failure when a exception is expected and nothing is thrown)
+ --%test(Gives failure when an exception is expected and nothing is thrown)
procedure nothing_thrown;
--%test(Single exception defined as a constant number in package)
@@ -45,19 +49,19 @@ is
--%test(Gives success when one of annotated exception using constant is thrown)
procedure list_of_exc_constant;
- --%test(Gives failure when the raised exception is different that the annotated one using variable)
+ --%test(Gives failure when the raised exception is different than the annotated one using variable)
procedure fail_not_match_exc;
- --%test(Success when one of exception from mixed list of number and constant is thrown)
+ --%test(Success when one of exception from a mixed list of number and constant is thrown)
procedure mixed_exc_list;
- --%test(Success when match exception even if other variable on list dont exists)
+ --%test(Success when match exception even if another variable on list doesn't exists)
procedure mixed_list_notexi;
--%test(Success resolve and match named exception defined in pragma exception init)
procedure named_exc_pragma;
-
- --%test(Success resolve and match oracle named exception no data)
+
+ --%test(Success resolve and match oracle named exception no data)
procedure named_exc_ora;
--%test(Success resolve and match oracle named exception dup val index)
@@ -73,10 +77,32 @@ is
procedure non_existing_const;
--%test(Bad exception constant)
- procedure bad_exc_const;
+ procedure bad_exc_const;
+
+ --%test(Uninitialized exception variable can be used successfully in a test)
+ procedure referencing_uninitialized_exception;
+
+ --%test(a Failure report shows all expected exceptions)
+ procedure not_throwing_expected_exceptions;
- --%afterall
- procedure drop_test_package;
+ --%context(referencing exceptions when running from another schema)
+
+ --%beforeall
+ procedure run_from_another_schema;
+
+ --%test(Success referencing an exception variable when running from another schema)
+ procedure named_exc_pragma_run_from_another_schema;
+
+ --%test(Success referencing a numeric exception variable when running from another schema)
+ procedure exc_number_var_run_from_another_schema;
+
+ --%test(Success referencing an exception variable without a package name when running from another schema)
+ procedure named_exc_pragma_run_from_another_schema_no_package_name;
+
+ --%test(Success referencing a numeric exception variable without a package name when running from another schema)
+ procedure exc_number_var_run_from_another_schema_no_package_name;
+
+ --%endcontext
end;
/
diff --git a/test/ut3_tester/core/annotations/test_annotation_cache.pkb b/test/ut3_tester/core/annotations/test_annotation_cache.pkb
index eefaf8800..36f8f983d 100644
--- a/test/ut3_tester/core/annotations/test_annotation_cache.pkb
+++ b/test/ut3_tester/core/annotations/test_annotation_cache.pkb
@@ -517,5 +517,134 @@ create or replace package body test_annotation_cache is
cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
end;
+ procedure user_runs_child_of_hidden_suite is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.child_suite' );
+ --Assert
+ ut.expect( l_actual ).to_be_like( '%parent_suite%child_test%1 tests, 0 failed%' );
+ ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
+ rollback;
+ end;
+
+ procedure user_warned_about_hidden_parent is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.child_suite' );
+ --Assert
+ ut.expect( l_actual ).to_be_like(
+ '%Warnings:%parent_suite%Suite ut3_cache_test_owner.parent_suite is not run, as it does not exist or you have no EXECUTE privilege on it.%'
+ );
+ ut.expect( l_actual ).to_be_like( '%1 tests, 0 failed, 0 errored, 0 disabled, 1 warning(s)%' );
+ rollback;
+ end;
+
+ procedure user_runs_child_without_parent_tags is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act - child_suite inherits parent_tag only when parent_suite is accessible
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner', '!parent_tag' );
+ --Assert
+ ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
+ --Act
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_cache_test_owner', 'ut3_cache_test_owner', '!parent_tag' );
+ --Assert
+ ut.expect( l_actual ).not_to_be_like( '%child_test%' );
+ ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
+ rollback;
+ end;
+
+ procedure user_runs_hidden_suite_path is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:parent_suite' );
+ --Assert
+ ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
+ ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
+ rollback;
+ end;
+
+ procedure user_no_empty_logical_suites is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act
+ l_actual := annotation_cache_helper.get_suites_info_as( 'ut3_no_extra_priv_user' );
+ --Assert
+ ut.expect( l_actual ).to_be_like( '%UT_TEST parent_suite.child_suite.child_test%' );
+ ut.expect( l_actual ).not_to_be_like( '%hidden_path%' );
+ ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
+ rollback;
+ end;
+
+ procedure user_runs_granted_by_wildcard is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act - matches child_suite (granted) and lone_suite (not granted)
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.*l*_suite' );
+ --Assert
+ ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
+ ut.expect( l_actual ).not_to_be_like( '%lone_test%' );
+ rollback;
+ end;
+
+ procedure user_runs_granted_tests_by_wildcard is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act - matches child_suite.child_test (granted) and lone_suite.lone_test (not granted)
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner.*l*_suite.*_test' );
+ --Assert
+ ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
+ ut.expect( l_actual ).not_to_be_like( '%lone_test%' );
+ rollback;
+ end;
+
+ procedure user_runs_granted_by_path_wildcard is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act - matches parent_suite (not granted) and parent_suite.child_suite (granted)
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:parent*' );
+ --Assert
+ ut.expect( l_actual ).to_be_like( '%child_test%1 tests, 0 failed%' );
+ ut.expect( l_actual ).not_to_be_like( '%parent_test%' );
+ rollback;
+ end;
+
+ procedure user_hidden_path_wildcard_not_found is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act - matches only hidden_path.sub.lone_suite (not granted)
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:hidden*' );
+ rollback;
+ exception
+ when others then
+ rollback;
+ raise;
+ end;
+
+ procedure user_hidden_path_not_found is
+ l_actual clob;
+ pragma autonomous_transaction;
+ begin
+ --Act
+ l_actual := annotation_cache_helper.run_tests_as( 'ut3_no_extra_priv_user', 'ut3_cache_test_owner:hidden_path' );
+ rollback;
+ exception
+ when others then
+ rollback;
+ raise;
+ end;
+
end;
/
diff --git a/test/ut3_tester/core/annotations/test_annotation_cache.pks b/test/ut3_tester/core/annotations/test_annotation_cache.pks
index 5a3fdd8ca..fec89cf3b 100644
--- a/test/ut3_tester/core/annotations/test_annotation_cache.pks
+++ b/test/ut3_tester/core/annotations/test_annotation_cache.pks
@@ -276,5 +276,44 @@ create or replace package test_annotation_cache is
--%endcontext
+ --%context(Suites spread across packages, user without elevated privileges)
+ --%beforeall(annotation_cache_helper.enable_ddl_trigger)
+ --%beforeall(annotation_cache_helper.setup_suite_hierarchy)
+ --%afterall(annotation_cache_helper.cleanup_suite_hierarchy)
+
+ --%test(Runs a granted package whose parent suite is in a package that is not granted)
+ procedure user_runs_child_of_hidden_suite;
+
+ --%test(Warns that the parent suite in a package that is not granted is not run)
+ procedure user_warned_about_hidden_parent;
+
+ --%test(Does not apply tags of the parent suite in a package that is not granted)
+ procedure user_runs_child_without_parent_tags;
+
+ --%test(Runs a granted package when its parent suitepath is given)
+ procedure user_runs_hidden_suite_path;
+
+ --%test(Lists no logical suites without granted packages below them)
+ procedure user_no_empty_logical_suites;
+
+ --%test(Raises an error for a suitepath without granted packages below it)
+ --%throws(-20204)
+ procedure user_hidden_path_not_found;
+
+ --%test(Runs only granted packages matched by a package name with wildcards)
+ procedure user_runs_granted_by_wildcard;
+
+ --%test(Runs only tests of granted packages matched by procedure name with wildcards)
+ procedure user_runs_granted_tests_by_wildcard;
+
+ --%test(Runs granted packages below a suitepath with wildcards)
+ procedure user_runs_granted_by_path_wildcard;
+
+ --%test(Raises an error for a suitepath with wildcards without granted packages below it)
+ --%throws(-20204)
+ procedure user_hidden_path_wildcard_not_found;
+
+ --%endcontext
+
end;
/
diff --git a/test/ut3_tester/core/expectations/test_expectation_processor.pkb b/test/ut3_tester/core/expectations/test_expectation_processor.pkb
index 63ce3c791..e93d93141 100644
--- a/test/ut3_tester/core/expectations/test_expectation_processor.pkb
+++ b/test/ut3_tester/core/expectations/test_expectation_processor.pkb
@@ -1,6 +1,8 @@
create or replace package body test_expectation_processor is
gc_user constant varchar2(128) := sys_context('userenv','current_schema');
+ gc_long_line_package constant varchar2(128) := 'TEST_EXPECTATION_LONG_LINE';
+ gc_long_line constant varchar2(4000) := 'ut.expect(1).to_equal(2); /*'||rpad('*', 3900, '*')||'*/';
procedure who_called_expectation is
l_stack_trace varchar2(4000);
@@ -13,7 +15,7 @@ create or replace package body test_expectation_processor is
353dfeb2f8 26 SCH_TEST.UT_EXPECTATION_RESULT
cba2493ce0 112 SCH_TEST.UT_EXPECTATION
3539881cf0 21 SCH_TEST.UT_EXPECTATION_NUMBER
-351a608008 7 package body ]'||gc_user||q'[.TEST_EXPECTATION_PROCESSOR
+351a608008 9 package body ]'||gc_user||q'[.TEST_EXPECTATION_PROCESSOR
351a608018 12 package body ]'||gc_user||q'[.TEST_EXPECTATION_PROCESSOR
351a608018 24 package body ]'||gc_user||q'[.TEST_EXPECTATION_PROCESSOR
351a6862b8 6 anonymous block
@@ -34,7 +36,7 @@ cba24bfad0 75 SCH_TEST.UT_LOGICAL_SUITE
]';
ut.expect(
ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace)
- ).to_equal('at "'||gc_user||'.TEST_EXPECTATION_PROCESSOR", line 7 l_source_line varchar2(4000);
+ ).to_equal('at "'||gc_user||'.TEST_EXPECTATION_PROCESSOR", line 9 l_source_line varchar2(4000);
at "'||gc_user||'.TEST_EXPECTATION_PROCESSOR", line 12
at "'||gc_user||'.TEST_EXPECTATION_PROCESSOR", line 24');
end;
@@ -101,5 +103,71 @@ handle number name
).to_be_like('at "SCOTT.TEST_BETWNSTR.BASIC_USAGE", line 7 %');
end;
+ procedure create_long_line_package is
+ pragma autonomous_transaction;
+ begin
+ execute immediate 'create or replace package '||gc_long_line_package||' is
+ procedure long_line;
+end;';
+ execute immediate 'create or replace package body '||gc_long_line_package||' is
+ procedure long_line is
+ begin
+ '||gc_long_line||'
+ end;
+end;';
+ end;
+
+ procedure drop_long_line_package is
+ pragma autonomous_transaction;
+ begin
+ execute immediate 'drop package '||gc_long_line_package;
+ end;
+
+ procedure who_called_exp_long_line is
+ l_stack_trace varchar2(4000);
+ l_result varchar2(32767);
+ begin
+ l_stack_trace := q'[----- PL/SQL Call Stack -----
+ object line object
+ handle number name
+0x80e701d8 26 UT3_DEVELOP.UT_EXPECTATION_RESULT
+0x85e10150 112 UT3_DEVELOP.UT_EXPECTATION
+0x8b54bad8 21 UT3_DEVELOP.UT_EXPECTATION_NUMBER
+0x85cfd238 4 package body ]'||gc_user||'.'||gc_long_line_package||q'[
+0x85def380 6 anonymous block
+]';
+ l_result := ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace);
+
+ ut.expect( l_result ).to_equal(
+ 'at "'||gc_user||'.'||gc_long_line_package||'", line 4 '
+ || substr( gc_long_line, 1, 500 - length('[...]') ) || '[...]'
+ || chr(10) || 'at "anonymous block", line 6'
+ );
+ end;
+
+ procedure who_called_exp_long_stack is
+ l_stack_trace varchar2(32767);
+ l_result varchar2(32767);
+ begin
+ l_stack_trace := q'[----- PL/SQL Call Stack -----
+ object line object
+ handle number name
+0x80e701d8 26 UT3_DEVELOP.UT_EXPECTATION_RESULT
+0x85e10150 112 UT3_DEVELOP.UT_EXPECTATION
+0x8b54bad8 21 UT3_DEVELOP.UT_EXPECTATION_NUMBER
+0x85cfd238 4 package body ]'||gc_user||'.'||gc_long_line_package||chr(10);
+ -- distinct callers, so the stack after the first frame is long
+ for i in 1 .. 100 loop
+ l_stack_trace := l_stack_trace
+ || '0x85cfd238 '||to_char(1000 + i)||' package body '||gc_user||'.'||gc_long_line_package||chr(10);
+ end loop;
+
+ l_result := ut3_develop.ut_expectation_processor.who_called_expectation(l_stack_trace);
+
+ ut.expect( lengthb( l_result ) ).to_be_less_or_equal( 4000 );
+ ut.expect( l_result ).to_be_like( 'at "'||gc_user||'.'||gc_long_line_package||'", line 4 ut.expect(1).to_equal(2); /*%' );
+ ut.expect( l_result ).to_be_like( '%[...]' );
+ end;
+
end;
/
diff --git a/test/ut3_tester/core/expectations/test_expectation_processor.pks b/test/ut3_tester/core/expectations/test_expectation_processor.pks
index 6087eb045..4797dd613 100644
--- a/test/ut3_tester/core/expectations/test_expectation_processor.pks
+++ b/test/ut3_tester/core/expectations/test_expectation_processor.pks
@@ -19,5 +19,21 @@ create or replace package test_expectation_processor is
--%endcontext
+ --%context(who_called_expectation_long_lines)
+
+ --%beforeall
+ procedure create_long_line_package;
+
+ --%afterall
+ procedure drop_long_line_package;
+
+ --%test(truncates a long source line of the calling code - regression for #1397)
+ procedure who_called_exp_long_line;
+
+ --%test(limits caller info to 4000 bytes when the call stack is long - regression for #1397)
+ procedure who_called_exp_long_stack;
+
+ --%endcontext
+
end;
/
diff --git a/test/ut3_tester/core/test_coverage_report_html_helper.pkb b/test/ut3_tester/core/test_coverage_report_html_helper.pkb
new file mode 100644
index 000000000..a4cd36ed1
--- /dev/null
+++ b/test/ut3_tester/core/test_coverage_report_html_helper.pkb
@@ -0,0 +1,29 @@
+create or replace package body test_coverage_report_html_helper is
+
+ gc_support_link constant varchar2(4000) :=
+ '' || ut3_develop.ut_utils.gc_support_text || '';
+
+ function get_index(a_support_info boolean) return clob is
+ l_coverage_data ut3_develop.ut_coverage.t_coverage;
+ begin
+ return ut3_develop.ut_utils.table_to_clob(
+ ut3_develop.ut_coverage_report_html_helper.get_index(
+ a_coverage_data => l_coverage_data,
+ a_assets_path => null,
+ a_support_info => a_support_info
+ )
+ );
+ end;
+
+ procedure index_includes_support_link is
+ begin
+ ut.expect( get_index(a_support_info => true) ).to_be_like( '%%' );
+ end;
+
+ procedure index_omits_support_link is
+ begin
+ ut.expect( get_index(a_support_info => false) ).not_to_be_like( '%' || ut3_develop.ut_utils.gc_support_url || '%' );
+ end;
+
+end;
+/
diff --git a/test/ut3_tester/core/test_coverage_report_html_helper.pks b/test/ut3_tester/core/test_coverage_report_html_helper.pks
new file mode 100644
index 000000000..bad1192b8
--- /dev/null
+++ b/test/ut3_tester/core/test_coverage_report_html_helper.pks
@@ -0,0 +1,13 @@
+create or replace package test_coverage_report_html_helper is
+
+ --%suite(coverage_report_html_helper)
+ --%suitepath(utplsql.ut3_tester.core)
+
+ --%test(Index page footer includes support link by default)
+ procedure index_includes_support_link;
+
+ --%test(Index page footer omits support link when switched off)
+ procedure index_omits_support_link;
+
+end;
+/
diff --git a/test/ut3_tester/core/test_output_buffer.pkb b/test/ut3_tester/core/test_output_buffer.pkb
index 55670b8b8..de53b957a 100644
--- a/test/ut3_tester/core/test_output_buffer.pkb
+++ b/test/ut3_tester/core/test_output_buffer.pkb
@@ -1,5 +1,14 @@
create or replace package body test_output_buffer is
+ -- Writer action that waits (up to 30 seconds) until the reader removes the buffer info.
+ -- It keeps the writer only as long as the test needs it, so it does not delay jobs of the following tests.
+ gc_wait_for_reader_to_finish constant varchar2(4000) := q'[
+ for i in 1 .. 300 loop
+ select count(1) into l_info_count from ut3_develop.ut_output_buffer_info_tmp b where b.output_id = l_buffer.output_id;
+ exit when l_info_count = 0;
+ dbms_session.sleep(0.1);
+ end loop;]';
+
function long_text return varchar2 is
l_txt varchar2(32767);
begin
@@ -8,6 +17,56 @@ create or replace package body test_output_buffer is
end loop;
return l_txt;
end;
+
+ -- Runs a_writer_actions in a separate session (scheduler job) on a buffer sharing output_id with a_reader.
+ -- The writer buffer is available to the actions as l_buffer.
+ procedure start_writer(a_reader ut3_develop.ut_output_buffer_base, a_writer_actions varchar2) is
+ begin
+ ut3_tester_helper.run_helper.run_as_job(
+ 'declare
+ l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.'||a_reader.self_type||'(a_output_id => '''||a_reader.output_id||''');
+ l_info_count integer;
+ begin
+ '||a_writer_actions||'
+ end;'
+ );
+ end;
+
+ procedure wait_for_writer_lock(a_reader ut3_develop.ut_output_buffer_base) is
+ c_max_wait_sec constant number := 30;
+ l_waited_sec number := 0;
+ begin
+ while a_reader.get_lock_status() = 0 and l_waited_sec < c_max_wait_sec loop
+ dbms_session.sleep(0.1);
+ l_waited_sec := l_waited_sec + 0.1;
+ end loop;
+ ut.expect(a_reader.get_lock_status(), 'Writer session holds the buffer lock').not_to_equal(0);
+ end;
+
+ procedure reads_lines_from_writer(a_reader ut3_develop.ut_output_buffer_base) is
+ l_actual sys_refcursor;
+ l_expected sys_refcursor;
+ begin
+ --Arrange - writer stays silent for 1 second longer than reader's initial timeout
+ start_writer(
+ a_reader,
+ q'[l_buffer.lock_buffer();
+ dbms_session.sleep(1.2);
+ l_buffer.send_line('line 1');
+ l_buffer.send_line('line 2');
+ l_buffer.close();]'
+ );
+ wait_for_writer_lock(a_reader);
+ --Act
+ open l_actual for
+ select to_char(text) as text from table(a_reader.get_lines(a_initial_timeout => 0.2, a_timeout_sec => 30));
+ --Assert
+ open l_expected for
+ select 'line 1' as text from dual union all
+ select 'line 2' as text from dual;
+ ut.expect(l_actual).to_equal(l_expected);
+ end;
+
procedure test_receive is
l_actual_text clob;
l_actual_item_type varchar2(1000);
@@ -213,5 +272,99 @@ create or replace package body test_output_buffer is
l_consumer_buffer_instance := ut3_develop.ut_output_table_buffer(a_output_id => l_shared_output_id);
end;
+ procedure table_buffer_reads_from_writer is
+ begin
+ reads_lines_from_writer(ut3_develop.ut_output_table_buffer());
+ end;
+
+ procedure clob_buffer_reads_from_writer is
+ begin
+ reads_lines_from_writer(ut3_develop.ut_output_clob_table_buffer());
+ end;
+
+ procedure bulk_buffer_reads_from_writer is
+ begin
+ reads_lines_from_writer(ut3_develop.ut_output_bulk_buffer());
+ end;
+
+ procedure reader_stops_when_writer_ends is
+ l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
+ l_lines ut3_develop.ut_varchar2_rows;
+ l_start timestamp;
+ l_duration interval day to second;
+ begin
+ --Arrange - writer keeps the lock for a while after sending and its session ends without calling close()
+ start_writer(
+ l_buffer,
+ q'[l_buffer.lock_buffer();
+ l_buffer.send_line('line 1');
+ dbms_session.sleep(0.5);]'
+ );
+ wait_for_writer_lock(l_buffer);
+ l_start := localtimestamp;
+ --Act
+ begin
+ select to_char(text) bulk collect into l_lines
+ from table(l_buffer.get_lines(a_initial_timeout => 1, a_timeout_sec => 2));
+ exception
+ when others then
+ ut.fail('Reader did not stop after writer session ended: '||sqlerrm);
+ end;
+ l_duration := localtimestamp - l_start;
+ --Assert
+ ut.expect(anydata.convertCollection(l_lines)).to_equal(anydata.convertCollection(ut3_develop.ut_varchar2_rows('line 1')));
+ ut.expect(l_buffer.get_lock_status(), 'Writer lock released by session end').to_equal(0);
+ ut.expect(l_duration, 'Reader waited for writer session to end').to_be_greater_or_equal(interval '0.3' second);
+ end;
+
+ procedure reader_times_out_on_idle_writer is
+ l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
+ l_count integer;
+ begin
+ --Arrange - writer holds the lock without sending data until the reader gives up
+ start_writer(
+ l_buffer,
+ q'[l_buffer.lock_buffer();
+ l_buffer.send_line('line 1');]'
+ ||gc_wait_for_reader_to_finish||q'[
+ l_buffer.close();]'
+ );
+ wait_for_writer_lock(l_buffer);
+ --Act
+ begin
+ select count(1) into l_count from table(l_buffer.get_lines(a_initial_timeout => 1, a_timeout_sec => 1));
+ ut.fail('Expected a timeout exception but nothing was raised');
+ exception
+ when others then
+ --Assert
+ ut.expect(dbms_utility.format_error_stack()).to_match('ORA'||ut3_develop.ut_utils.gc_out_buffer_timeout);
+ end;
+ end;
+
+ procedure second_writer_cannot_lock is
+ l_buffer ut3_develop.ut_output_buffer_base := ut3_develop.ut_output_table_buffer();
+ begin
+ --Arrange - writer holds the lock until the test is done
+ start_writer(
+ l_buffer,
+ q'[l_buffer.lock_buffer();]'
+ ||gc_wait_for_reader_to_finish||q'[
+ l_buffer.close();]'
+ );
+ wait_for_writer_lock(l_buffer);
+ --Act
+ begin
+ l_buffer.lock_buffer();
+ l_buffer.close();
+ ut.fail('Expected lock_buffer to fail but it succeeded');
+ exception
+ when others then
+ --Assert
+ ut.expect(sqlerrm).to_be_like('%Cannot allocate lock for output buffer of reporter%');
+ end;
+ --Cleanup - let the writer finish
+ l_buffer.remove_buffer_info();
+ end;
+
end test_output_buffer;
/
diff --git a/test/ut3_tester/core/test_output_buffer.pks b/test/ut3_tester/core/test_output_buffer.pks
index aa5c830d3..1b5a04762 100644
--- a/test/ut3_tester/core/test_output_buffer.pks
+++ b/test/ut3_tester/core/test_output_buffer.pks
@@ -4,59 +4,68 @@ create or replace package test_output_buffer is
--%suitepath(utplsql.ut3_tester.core)
- --%context(Read and write within the same session)
+ --%context(Buffer is read in a different session than buffer write)
+
+ --%test(Text buffer reader waits beyond initial timeout for writer holding the lock and reads all lines)
+ procedure table_buffer_reads_from_writer;
+
+ --%test(Clob buffer reader waits beyond initial timeout for writer holding the lock and reads all lines)
+ procedure clob_buffer_reads_from_writer;
+
+ --%test(Bulk buffer reader waits beyond initial timeout for writer holding the lock and reads all lines)
+ procedure bulk_buffer_reads_from_writer;
+ --%test(Reader stops when writer session ends without closing the buffer)
+ procedure reader_stops_when_writer_ends;
+
+ --%test(Reader times out when writer holds the lock and sends no data)
+ procedure reader_times_out_on_idle_writer;
+
+ --%test(Writer cannot lock buffer that is locked by another session)
+ procedure second_writer_cannot_lock;
--%endcontext
-
- --%context(Buffer is read in a different session than buffer write)
- --reader will wait for a_initial_timeout seconds for the writer process to start and then it will finish with error
+ --%context(Read and write within the same session)
+
- --reader will wait forever (beyond a_initial_timeout) if the writer process is started and end of data row was not received from the buffer
+ --%test(Receives a line from buffer table and deletes)
+ procedure test_receive;
- --reader stops after reading the end of data signal from the buffer
+ --%test(Waits specified time for producer to lock the buffer )
+ --%throws(-20218)
+ procedure test_wait_for_producer;
- --reader stops when writer process ends and all data was read from the buffer
+ --%test(Does not send line if null text given)
+ procedure test_doesnt_send_on_null_text;
+ --%test(Does not send line if null text given for multiline case)
+ procedure test_doesnt_send_on_null_elem;
- --%endcontext
+ --%test(Sends a line into buffer table)
+ procedure test_send_line;
+
+ --%test(Waits For The Data To Appear For Specified Time)
+ procedure test_waiting_for_data;
+
+ --%test(Purges text buffer data older than one day and leaves the rest)
+ procedure test_purge_text_buffer;
+
+ --%test(Purges clob buffer data older than one day and leaves the rest)
+ procedure test_purge_clob_buffer;
- --%test(Receives a line from buffer table and deletes)
- procedure test_receive;
-
- --%test(Waits specified time for producer to lock the buffer )
- --%throws(-20218)
- procedure test_wait_for_producer;
-
- --%test(Does not send line if null text given)
- procedure test_doesnt_send_on_null_text;
-
- --%test(Does not send line if null text given for multiline case)
- procedure test_doesnt_send_on_null_elem;
-
- --%test(Sends a line into buffer table)
- procedure test_send_line;
-
- --%test(Waits For The Data To Appear For Specified Time)
- procedure test_waiting_for_data;
-
- --%test(Purges text buffer data older than one day and leaves the rest)
- procedure test_purge_text_buffer;
-
- --%test(Purges clob buffer data older than one day and leaves the rest)
- procedure test_purge_clob_buffer;
-
- --%test(Successfully sends multibyte long line into text buffer)
- procedure text_buffer_send_multibyte;
-
- --%test(Successfully sends multibyte long clob line into text buffer)
- procedure text_buffer_send_clob_multib;
-
- --%beforetest(ut3_tester_helper.run_helper.slow_down_insert_into_table_buffer)
- --%aftertest(ut3_tester_helper.run_helper.cleanup_slow_down_insert_into_table_buffer)
- --%test(concurrent calls to init() procedure do not cause errors - Issue #985)
- procedure concurrent_calls_do_not_cause_exception;
+ --%test(Successfully sends multibyte long line into text buffer)
+ procedure text_buffer_send_multibyte;
+
+ --%test(Successfully sends multibyte long clob line into text buffer)
+ procedure text_buffer_send_clob_multib;
+
+ --%beforetest(ut3_tester_helper.run_helper.slow_down_insert_into_table_buffer)
+ --%aftertest(ut3_tester_helper.run_helper.cleanup_slow_down_insert_into_table_buffer)
+ --%test(concurrent calls to init() procedure do not cause errors - Issue #985)
+ procedure concurrent_calls_do_not_cause_exception;
+
+ --%endcontext
end test_output_buffer;
/
diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb
index 570d86a0d..15aac2d01 100644
--- a/test/ut3_tester/core/test_suite_builder.pkb
+++ b/test/ut3_tester/core/test_suite_builder.pkb
@@ -20,8 +20,7 @@ create or replace package body test_suite_builder is
a_owner_name => 'UT3_TESTER',
a_annotated_objects => l_cursor,
a_path => null,
- a_object_name => a_package_name,
- a_skip_all_objects => true
+ a_object_name => a_package_name
);
l_suite := treat( l_suites(l_suites.first) as ut3_develop.ut_logical_suite);
@@ -1370,6 +1369,54 @@ create or replace package body test_suite_builder is
);
end;
+ procedure context_name_case_insensitive is
+ l_actual clob;
+ l_annotations ut3_develop.ut_annotations;
+ begin
+ --Arrange
+ l_annotations := ut3_develop.ut_annotations(
+ ut3_develop.ut_annotation(1, 'suite','Cool', null),
+ ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
+ ut3_develop.ut_annotation(3, 'test','In suite', 'suite_level_test'),
+ ut3_develop.ut_annotation(4, 'context','A context', null),
+ ut3_develop.ut_annotation(5, 'name','a_Context', null),
+ ut3_develop.ut_annotation(6, 'beforeall',null, 'context_setup'),
+ ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
+ ut3_develop.ut_annotation(8, 'endcontext',null, null)
+ );
+ --Act
+ l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
+ --Assert
+ ut.expect(l_actual).to_be_like(
+ ''||
+ '' ||
+ '%' ||
+ '%' ||
+ '' ||
+ '%suite_level_testIn suitesome_package.suite_level_test' ||
+ '%' ||
+ '' ||
+ '%a_contextA contextsome_package.a_context' ||
+ '%' ||
+ '' ||
+ '%test_in_a_contextIn contextsome_package.a_context.test_in_a_context' ||
+ '%' ||
+ '' ||
+ '' ||
+ '%some_packagecontext_setup' ||
+ '%' ||
+ '' ||
+ '' ||
+ '' ||
+ '' ||
+ '%some_packagesuite_level_beforeall' ||
+ '%' ||
+ '' ||
+ ''||
+ '
'
+ );
+ end;
+
procedure throws_value_empty is
l_actual clob;
l_annotations ut3_develop.ut_annotations;
diff --git a/test/ut3_tester/core/test_suite_builder.pks b/test/ut3_tester/core/test_suite_builder.pks
index 4cbfcad74..09ff3c0b3 100644
--- a/test/ut3_tester/core/test_suite_builder.pks
+++ b/test/ut3_tester/core/test_suite_builder.pks
@@ -142,7 +142,7 @@ create or replace package test_suite_builder is
--%test(Falls back to default context name and gives warning when name contains spaces)
procedure name_with_spaces_invalid;
- --%test(Raises warning when more than one name annotation used )
+ --%test(Raises warning when more than one name annotation used)
procedure duplicate_name_annotation;
--%test(Is ignored when used outside of context - no warning given)
@@ -154,6 +154,9 @@ create or replace package test_suite_builder is
--%test(Is applied to corresponding context when multiple contexts used)
procedure multiple_contexts;
+ --%test(Context name is case insensitive)
+ procedure context_name_case_insensitive;
+
--%endcontext
--%context(--%throws annotation)
diff --git a/test/ut3_tester/core/test_suite_manager.pkb b/test/ut3_tester/core/test_suite_manager.pkb
index c818ad212..8ab9b96d9 100644
--- a/test/ut3_tester/core/test_suite_manager.pkb
+++ b/test/ut3_tester/core/test_suite_manager.pkb
@@ -502,6 +502,36 @@ end test2_multi_wildcard;]';
end;
+ function count_tests(a_items ut3_develop.ut_suite_items) return integer is
+ l_count integer := 0;
+ begin
+ for i in 1 .. a_items.count loop
+ if a_items(i) is of (ut3_develop.ut_test) then
+ l_count := l_count + 1;
+ else
+ l_count := l_count + count_tests(treat(a_items(i) as ut3_develop.ut_logical_suite).items);
+ end if;
+ end loop;
+ return l_count;
+ end;
+
+ procedure test_overlapping_paths is
+ c_owner varchar2(128) := sys_context('USERENV', 'CURRENT_USER');
+ l_expected_items ut3_develop.ut_suite_items;
+ l_objects_to_run ut3_develop.ut_suite_items;
+ begin
+ --Arrange
+ l_expected_items := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list(c_owner||':tests'));
+ --Act - the packages are part of the suitepath
+ l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
+ ut3_develop.ut_varchar2_list(c_owner||':tests', c_owner||'.test_package_1', c_owner||'.test_package_2')
+ );
+ --Assert
+ ut.expect(count_tests(l_expected_items)).to_be_greater_than(0);
+ ut.expect(l_objects_to_run.count).to_equal(1);
+ ut.expect(count_tests(l_objects_to_run)).to_equal(count_tests(l_expected_items));
+ end;
+
procedure test_top2_by_name is
c_path varchar2(100) := sys_context('USERENV', 'CURRENT_USER')||'.test_package_2';
l_objects_to_run ut3_develop.ut_suite_items;
@@ -1254,7 +1284,7 @@ end;';
l_test_report ut3_develop.ut_varchar2_list;
begin
- select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER')||'.test_dependencies'));
+ select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER')||'.test_dependencies', a_support_info => 0));
ut.expect(l_test_report(l_test_report.count-1)).to_be_like('1 test_, 0 failed, 0 errored, 0 disabled, 0 warning(s)');
--execute immediate 'select * from table(ut3_develop.ut.run(''UT3_DEVELOP.test_dependencies'', ut3_develop.utplsql_test_reporter()))' into l_result;
@@ -1732,6 +1762,7 @@ end;]';
begin
select * bulk collect into l_test_report from table(ut3_develop.ut.run(sys_context('USERENV', 'CURRENT_USER') || '.test_removing_annotation'));
+ ut.fail('Expected exception ORA-20204 was not raised');
exception
when others then
ut.expect(sqlerrm).to_be_like('%ORA-20204: Suite package ut3_tester.test_removing_annotation does not exist%');
@@ -2218,6 +2249,115 @@ end;]';
end;
--%test(Path validation does not fail on Estonian NLS_SORT - fix #1252)
+ /*
+ Names that differ only where a "_" or "." is:
+ tst_char_a / tstxchar_a, test_a / testxa, chars.sub_a / chars.subxa, chars.sub / chars_sub
+ */
+ procedure create_char_test_packages is
+ pragma autonomous_transaction;
+ begin
+ execute immediate q'[create or replace package tst_char_a is
+ --%suite
+ --%suitepath(chars.sub_a)
+
+ --%test
+ procedure test_a;
+
+ --%test
+ procedure testxa;
+ end;]';
+ execute immediate q'[create or replace package tstxchar_a is
+ --%suite
+ --%suitepath(chars.subxa)
+
+ --%test
+ procedure test_a;
+ end;]';
+ execute immediate q'[create or replace package tst_char_b is
+ --%suite
+ --%suitepath(chars_sub)
+
+ --%test
+ procedure test_b;
+ end;]';
+ end;
+
+ procedure drop_char_test_packages is
+ pragma autonomous_transaction;
+ begin
+ execute immediate 'drop package tst_char_a';
+ execute immediate 'drop package tstxchar_a';
+ execute immediate 'drop package tst_char_b';
+ end;
+
+ --returns the paths of all tests, sorted and separated by commas
+ function get_test_paths(a_items ut3_develop.ut_suite_items) return varchar2 is
+ l_paths ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list();
+ l_result varchar2(32767);
+
+ procedure add_test_paths(a_suite_items ut3_develop.ut_suite_items) is
+ begin
+ for i in 1 .. a_suite_items.count loop
+ if a_suite_items(i) is of (ut3_develop.ut_test) then
+ l_paths.extend;
+ l_paths(l_paths.last) := a_suite_items(i).path;
+ else
+ add_test_paths(treat(a_suite_items(i) as ut3_develop.ut_logical_suite).items);
+ end if;
+ end loop;
+ end;
+ begin
+ add_test_paths(a_items);
+ select listagg(column_value, ',') within group (order by column_value) into l_result from table(l_paths);
+ return l_result;
+ end;
+
+ procedure underscore_in_package_name is
+ l_objects_to_run ut3_develop.ut_suite_items;
+ begin
+ --Act
+ l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
+ ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||'.tst_char_a')
+ );
+ --Assert
+ ut.expect(get_test_paths(l_objects_to_run)).to_equal('chars.sub_a.tst_char_a.test_a,chars.sub_a.tst_char_a.testxa');
+ end;
+
+ procedure underscore_in_procedure_name is
+ l_objects_to_run ut3_develop.ut_suite_items;
+ begin
+ --Act
+ l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
+ ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||'.tst_char_a.test_a')
+ );
+ --Assert
+ ut.expect(get_test_paths(l_objects_to_run)).to_equal('chars.sub_a.tst_char_a.test_a');
+ end;
+
+ procedure underscore_in_suitepath is
+ l_objects_to_run ut3_develop.ut_suite_items;
+ begin
+ --Act
+ l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
+ ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||':chars.sub_a')
+ );
+ --Assert
+ ut.expect(get_test_paths(l_objects_to_run)).to_equal('chars.sub_a.tst_char_a.test_a,chars.sub_a.tst_char_a.testxa');
+ end;
+
+ procedure dot_in_suitepath_wildcard is
+ l_objects_to_run ut3_develop.ut_suite_items;
+ begin
+ --Act
+ l_objects_to_run := ut3_develop.ut_suite_manager.configure_execution_by_path(
+ ut3_develop.ut_varchar2_list(sys_context('USERENV', 'CURRENT_USER')||':chars.sub*')
+ );
+ --Assert
+ ut.expect(get_test_paths(l_objects_to_run)).to_equal(
+ 'chars.sub_a.tst_char_a.test_a,chars.sub_a.tst_char_a.testxa,chars.subxa.tstxchar_a.test_a'
+ );
+ end;
+
procedure path_validate_nls_sort is
l_schema_names ut3_develop.ut_varchar2_rows;
begin
diff --git a/test/ut3_tester/core/test_suite_manager.pks b/test/ut3_tester/core/test_suite_manager.pks
index 44f102716..a7d3bcc20 100644
--- a/test/ut3_tester/core/test_suite_manager.pks
+++ b/test/ut3_tester/core/test_suite_manager.pks
@@ -15,6 +15,9 @@ create or replace package test_suite_manager is
--%test(Prepare runner for the top 2 package by package user.package_name)
procedure test_top2_by_name;
+ --%test(Prepare runner includes each suite item once when given paths overlap)
+ procedure test_overlapping_paths;
+
--%test(Prepare runner for the top2 package by name cur user)
procedure test_top2_bt_name_cur_user;
@@ -211,7 +214,7 @@ create or replace package test_suite_manager is
--%test(Execute test_packages using a procedure name with wildcard in the front)
procedure test_wild_card_front_prc_name;
- -- %test(Execute test_packages using a path name with wildcard in the front)
+ --%test(Execute test_packages using a path name with wildcard in the front)
procedure test_wild_card_front_path_name;
--%test(Execute test_packages using a object_name with wildcard in the middle)
@@ -220,7 +223,7 @@ create or replace package test_suite_manager is
--%test(Execute test_packages using a procedure name with wildcard in the middle)
procedure test_wild_card_mid_prc_name;
- -- %test(Execute test_packages using a path name with wildcard in the middle)
+ --%test(Execute test_packages using a path name with wildcard in the middle)
procedure test_wild_card_mid_path_name;
--%test(Execute test_packages using a object_name with multiple wildcards)
@@ -229,14 +232,36 @@ create or replace package test_suite_manager is
--%test(Execute test_packages using a procedure name with multiple wildcards)
procedure test_wild_card_mul_prc_name;
- -- %test(Execute test_packages using a path name with multiple wildcards)
+ --%test(Execute test_packages using a path name with multiple wildcards)
procedure test_wild_card_mul_path_name;
- -- %test(Execute test_packages using a path name with multiple wildcards on different level)
+ --%test(Execute test_packages using a path name with multiple wildcards on different level)
procedure tst_wild_card_mul_lv_path_name;
--%endcontext
+ --%context(literal_characters)
+ --%displayname(Characters other than * in a path match only themselves)
+
+ --%beforeall
+ procedure create_char_test_packages;
+ --%afterall
+ procedure drop_char_test_packages;
+
+ --%test(Underscore in a package name is not a wildcard)
+ procedure underscore_in_package_name;
+
+ --%test(Underscore in a procedure name is not a wildcard)
+ procedure underscore_in_procedure_name;
+
+ --%test(Underscore in a suitepath is not a wildcard)
+ procedure underscore_in_suitepath;
+
+ --%test(Dot in a suitepath with a wildcard is not a wildcard)
+ procedure dot_in_suitepath_wildcard;
+
+ --%endcontext
+
--%context(paths validation)
--%test(Path validation does not fail on Estonian NLS_SORT - fix #1252)
diff --git a/test/ut3_tester/core/test_ut_metadata.pkb b/test/ut3_tester/core/test_ut_metadata.pkb
new file mode 100644
index 000000000..905f31081
--- /dev/null
+++ b/test/ut3_tester/core/test_ut_metadata.pkb
@@ -0,0 +1,109 @@
+create or replace package body test_ut_metadata is
+
+ c_cr constant varchar2(1) := chr(13);
+ c_lf constant varchar2(2) := chr(10);
+ c_crlf constant varchar2(2) := chr(13)||chr(10);
+
+ c_pks_lf constant varchar2(1000) :=
+ 'create or replace package test_package1 is'||c_lf
+ ||' procedure test_max_length;'||c_lf
+ ||'end;'
+ ;
+ c_pkg_lf constant varchar2(20000) :=
+ q'[create or replace package body test_package1 is]'||c_lf
+ ||q'[ procedure test_max_length is]'||c_lf
+ ||q'[ begin]'||c_lf
+ ||q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_lf
+ ||substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_lf
+ ||q'[ dbms_output.put_line('test_max_length called.');]'||c_lf
+ ||q'[ end;]'||c_lf
+ ||q'[ end;]'
+ ;
+
+ procedure test_over_varchar2_limit_trim_first_4000_lf
+ is
+ l_actual varchar2(32767);
+ l_expect varchar2(32767);
+ begin
+ l_expect := trim(substrb(q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_lf, 1, 4000));
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 4);
+ ut.expect(l_actual).to_equal(l_expect);
+
+ l_expect := trim(substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_lf);
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 5);
+ ut.expect(l_actual).to_equal(l_expect);
+
+ l_expect := 'dbms_output.put_line(''test_max_length called.'');'||c_lf;
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 6);
+ ut.expect(l_actual).to_equal(l_expect);
+ end;
+
+ procedure test_over_varchar2_limit_trim_first_4000_crlf is
+ l_actual varchar2(32767);
+ l_expect varchar2(32767);
+ begin
+ l_expect := trim(substrb(q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_crlf, 1, 4000));
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 4);
+ ut.expect(l_actual).to_equal(l_expect);
+
+ l_expect := trim(substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_cr);
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 5);
+ ut.expect(l_actual).to_equal(l_expect);
+
+ l_expect := 'dbms_output.put_line(''test_max_length called.'');'||c_crlf;
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 6);
+ ut.expect(l_actual).to_equal(l_expect);
+ end;
+
+ procedure test_over_varchar2_limit_trim_first_4000_cr
+ is
+ l_actual varchar2(32767);
+ l_expect varchar2(32767);
+ begin
+ l_expect := trim(substrb(q'[ /* long comment over 4000 characters 1]'||rpad('*', 8000, '*')||'*/'||c_cr, 1, 4000));
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 4);
+ ut.expect(l_actual).to_equal(l_expect);
+
+ l_expect := trim(substrb(q'[ /* long comment 3999 and linebreak]'||rpad('*', 4000, '*'), 1, 3997)||'*/'||c_cr);
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 5);
+ ut.expect(l_actual).to_equal(l_expect);
+
+ l_expect := 'ut.expect(l_actual).to_equal(l_expect);'||c_cr;
+ l_actual := ut3_develop.ut_metadata.get_source_definition_line('UT3_TESTER', 'TEST_PACKAGE1', 6);
+ ut.expect(l_actual).to_equal(l_expect);
+ end;
+
+ procedure clear_cache is
+ begin
+ ut3_develop.ut_metadata.reset_source_definition_cache();
+ end;
+
+ procedure drop_test_package is
+ pragma autonomous_transaction;
+ begin
+ execute immediate 'drop package test_package1';
+ end;
+
+ procedure create_test_package_lf is
+ pragma autonomous_transaction;
+ begin
+ execute immediate c_pks_lf;
+ execute immediate c_pkg_lf;
+ end;
+
+ procedure create_test_package_crlf is
+ pragma autonomous_transaction;
+ begin
+ execute immediate replace(c_pks_lf, c_lf, c_crlf);
+ execute immediate replace(c_pkg_lf, c_lf, c_crlf);
+ end;
+
+ procedure create_test_package_cr is
+ pragma autonomous_transaction;
+ begin
+ execute immediate replace(c_pks_lf, c_lf, c_cr);
+ execute immediate replace(c_pkg_lf, c_lf, c_cr);
+ end;
+
+end;
+/
\ No newline at end of file
diff --git a/test/ut3_tester/core/test_ut_metadata.pks b/test/ut3_tester/core/test_ut_metadata.pks
new file mode 100644
index 000000000..b4a1d601c
--- /dev/null
+++ b/test/ut3_tester/core/test_ut_metadata.pks
@@ -0,0 +1,34 @@
+create or replace package test_ut_metadata is
+ --%suite(ut_metadata)
+ --%suitepath(utplsql.ut3_tester.core)
+
+ --%context(get_source_definition_line)
+
+ --%test(source line over 4000 limit is trimmed to first 4000 [linebreeak lf])
+ --%beforetest(create_test_package_lf)
+ procedure test_over_varchar2_limit_trim_first_4000_lf;
+
+ --%test(source line over 4000 limit is trimmed to first 4000 [linebreeak:crlf])
+ --%beforetest(create_test_package_crlf)
+ procedure test_over_varchar2_limit_trim_first_4000_crlf;
+
+ --%disabled(PLS-00103 occurs when execute immediate CR package)
+ --%test(source line over 4000 limit is trimmed to first 4000 [linebreeak cr])
+ --%beforetest(create_test_package_cr)
+ procedure test_over_varchar2_limit_trim_first_4000_cr;
+
+ --%beforeeach
+ procedure clear_cache;
+ --%aftereach
+ procedure drop_test_package;
+
+ procedure create_test_package_lf;
+
+ procedure create_test_package_crlf;
+
+ procedure create_test_package_cr;
+
+ --%endcontext
+
+end;
+/
\ No newline at end of file
diff --git a/test/ut3_tester/core/test_ut_suite_tag_filter.pkb b/test/ut3_tester/core/test_ut_suite_tag_filter.pkb
index 7ce6a1c3e..34af60549 100644
--- a/test/ut3_tester/core/test_ut_suite_tag_filter.pkb
+++ b/test/ut3_tester/core/test_ut_suite_tag_filter.pkb
@@ -71,52 +71,285 @@ create or replace package body test_ut_suite_tag_filter is
ut.fail('Expected exception but nothing was raised');
end;
- procedure conv_from_tag_to_sql_filter is
- l_sql_filter varchar2(4000);
+ procedure conversion_throws_when_unmatched_rb is
+ l_postfix ut3_develop.ut_varchar2_list;
+ l_input_token ut3_develop.ut_varchar2_list;
+ begin
+ l_input_token := ut3_develop.ut_varchar2_list('(','a',')',')');
+ l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(l_input_token);
+ ut.fail('Expected exception but nothing was raised');
+ end;
+
+ procedure conversion_throws_when_empty is
+ l_postfix ut3_develop.ut_varchar2_list;
+ begin
+ l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(ut3_develop.ut_varchar2_list());
+ ut.fail('Expected exception but nothing was raised');
+ end;
+
+ procedure conversion_throws_when_trailing_opr is
+ l_postfix ut3_develop.ut_varchar2_list;
+ begin
+ l_postfix := ut3_develop.ut_suite_tag_filter.shunt_logical_expression(ut3_develop.ut_varchar2_list('a','|'));
+ ut.fail('Expected exception but nothing was raised');
+ end;
+
+ procedure tokenize_empty_string is
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.tokenize_tags_string(null).count ).to_equal(0);
+ end;
+
+ procedure is_matching_or_and_not is
begin
- l_sql_filter := ut3_develop.ut_suite_tag_filter.create_where_filter('test1');
- ut.expect(l_sql_filter).to_equal(q'['test1' member of tags]');
-
- l_sql_filter := ut3_develop.ut_suite_tag_filter.create_where_filter('test1|test2');
- ut.expect(l_sql_filter).to_equal(q'[('test1' member of tags or 'test2' member of tags)]');
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1', 'test1') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test2', 'test1') ).to_equal(0);
- l_sql_filter := ut3_develop.ut_suite_tag_filter.create_where_filter('test1|!test2');
- ut.expect(l_sql_filter).to_equal(q'[('test1' member of tags or not('test2' member of tags))]');
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test2', 'test1|test2') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test3', 'test1|test2') ).to_equal(0);
- l_sql_filter := ut3_develop.ut_suite_tag_filter.create_where_filter('test1&!test2');
- ut.expect(l_sql_filter).to_equal(q'[('test1' member of tags and not('test2' member of tags))]');
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test3', 'test1|!test2') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test2', 'test1|!test2') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1,test2', 'test1|!test2') ).to_equal(1);
+
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1', 'test1&!test2') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test1,test2', 'test1&!test2') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('test3', 'test1&!test2') ).to_equal(0);
+ end;
+
+ procedure is_matching_evaluates_tags is
+ l_tags varchar2(100) := 'db,slow';
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'slow') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'slow&db') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'slow&!db') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast|db') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, '!fast') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, '(fast|slow)&!(db&fast)') ).to_equal(1);
+ --legacy notation: "," is or, "-" is not
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast,slow') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'fast,-slow') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'none') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(l_tags, 'any') ).to_equal(1);
+ end;
+
+ procedure is_matching_without_tags is
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'none') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'any') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, '!slow') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'slow') ).to_equal(0);
+ end;
+
+ procedure is_matching_operator_precedence is
+ begin
+ --"&" binds stronger than "|"
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a|b&c') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b', 'a|b&c') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b,c', 'a|b&c') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('c', 'b&c|a') ).to_equal(0);
+ --brackets
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', '(a|b)&c') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,c', '(a|b)&c') ).to_equal(1);
+ --"!" binds stronger than "&"
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b', '!a&b') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,b', '!a&b') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', '!(a&b)') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,b', '!(a&b)') ).to_equal(0);
+ --double negation
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', '!!a') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('b', '!!a') ).to_equal(0);
+ end;
+
+ procedure is_matching_none_and_any_combined is
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'none|slow') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'none|slow') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db', 'none|slow') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', '!none') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, '!none') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, '!any') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'any&!slow') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db', 'any&!slow') ).to_equal(1);
+ end;
+
+ procedure is_matching_is_case_sensitive is
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('Slow', 'slow') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'SLOW') ).to_equal(0);
+ --upper case keywords are tags, not the none and any keywords
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, 'NONE') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', 'ANY') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('ANY', 'ANY') ).to_equal(1);
+ end;
+
+ procedure is_matching_ignores_whitespace is
+ c_tab constant varchar2(1) := chr(9);
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', ' slow & db ') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', ' ( fast | slow ) & ! db ') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', c_tab||'slow'||c_tab||'&'||c_tab||'db'||c_tab) ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', 'slow'||c_tab||'&'||c_tab||'!'||c_tab||'db') ).to_equal(0);
+ --legacy notation
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('db,slow', 'fast, slow') ).to_equal(1);
+ end;
+
+ procedure is_matching_empty_expression is
+ c_tab constant varchar2(1) := chr(9);
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', null) ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, null) ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', ' ') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, ' ') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', c_tab) ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(null, ' '||c_tab||' ') ).to_equal(1);
+ end;
+
+ procedure remove_whitespace_from_expression is
+ c_tab constant varchar2(1) := chr(9);
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(null) ).to_be_null();
+ ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(' ') ).to_be_null();
+ ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(' '||c_tab||c_tab||' ') ).to_be_null();
+ ut.expect( ut3_develop.ut_suite_tag_filter.remove_whitespace(' slow &'||c_tab||'db ') ).to_equal('slow&db');
+ end;
+
+ procedure is_matching_tag_with_quote is
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(q'[it's]', q'[it's]') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', q'[slow&!it's]') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', q'[it's]') ).to_equal(0);
+ end;
+
+ procedure is_matching_many_tags is
+ c_tag_prefix constant varchar2(30) := 'a_long_tag_name_for_testing_';
+ l_expression varchar2(32767);
+ begin
+ --80 tags of 31 characters, joined with "|": a condition with "member of" for each tag would be over 4000 characters
+ for i in 1 .. 80 loop
+ l_expression := l_expression || case when i > 1 then '|' end || c_tag_prefix || lpad(i, 3, '0');
+ end loop;
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching(c_tag_prefix||'080', l_expression) ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow,'||c_tag_prefix||'001', l_expression) ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('slow', l_expression) ).to_equal(0);
+ end;
+
+ procedure is_matching_null_tag_element is
+ begin
+ --'a,,b' has a null element, so "x member of" it is unknown (null) instead of false when x is not in the list
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'a') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'x') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', '!x') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'a|!x') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', 'a&!x') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a,,b', '!a&!x') ).to_equal(0);
+ end;
+
+ procedure is_matching_follows_expression_change is
+ l_result integer;
+ begin
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a') ).to_equal(1);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'b') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a') ).to_equal(1);
+ begin
+ l_result := ut3_develop.ut_suite_tag_filter.is_matching('a', 'a&');
+ ut.fail('Expected exception but nothing was raised');
+ exception
+ when others then
+ ut.expect( sqlcode ).to_equal( ut3_develop.ut_utils.gc_invalid_tag_expression );
+ end;
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'b') ).to_equal(0);
+ ut.expect( ut3_develop.ut_suite_tag_filter.is_matching('a', 'a') ).to_equal(1);
+ end;
+
+ procedure is_matching_invalid_expression is
+ l_result integer;
+ begin
+ l_result := ut3_develop.ut_suite_tag_filter.is_matching('slow', 'slow&|db');
+ end;
+
+ procedure is_matching_incomplete_expression is
+ --legacy notation turns ',' into an empty expression
+ l_expressions ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list('slow|', 'slow&!', '!', '(slow', ',');
+ l_result integer;
+ begin
+ for i in 1 .. l_expressions.count loop
+ begin
+ l_result := ut3_develop.ut_suite_tag_filter.is_matching('slow', l_expressions(i));
+ ut.fail('Expected exception for tag expression "'||l_expressions(i)||'" but nothing was raised');
+ exception
+ when others then
+ ut.expect( sqlcode, 'Tag expression "'||l_expressions(i)||'"' ).to_equal( ut3_develop.ut_utils.gc_invalid_tag_expression );
+ end;
+ end loop;
+ end;
+
+ procedure create_tags_suite is
+ pragma autonomous_transaction;
+ begin
+ execute immediate q'[create or replace package test_tags_1324 as
+ --%suite
+ --%suitepath(some.path)
+ --%tags(slow)
+
+ --%context(tags_are_applied_in_contexts)
+ --%tags(context_tag)
+
+ --%test
+ --%tags(test_tag)
+ procedure create_new_mapping;
+
+ --%endcontext
+ end;]';
+ execute immediate q'[create or replace package body test_tags_1324 as
+ procedure create_new_mapping is begin null; end;
+ end;]';
+ end;
+
+ procedure drop_tags_suite is
+ pragma autonomous_transaction;
+ begin
+ execute immediate 'drop package test_tags_1324';
end;
procedure filtering_is_correctly_applied_to_all_items is
- l_input_data ut3_develop.ut_suite_cache_rows;
- l_expected sys_refcursor;
- l_actual sys_refcursor;
- begin
- l_input_data := ut3_develop.ut_suite_cache_rows(
- ut3_develop.ut_suite_cache_row(
- 1, 'UT_SUITE', 'some.path.test_tags', 'TEST_USER', 'TEST_TAGS', 'TEST_TAGS', 3, timestamp '2026-05-06 10:23:38.461299', NULL, NULL, 0, NULL, null, null, null, null, null, null, null, null,
- ut3_develop.ut_varchar2_rows('slow'), null),
- ut3_develop.ut_suite_cache_row(
- 2, 'UT_SUITE_CONTEXT', 'some.path.test_tags.nested_context_#1', 'TEST_USER', 'TEST_TAGS', 'NESTED_CONTEXT_#1', 9, timestamp '2026-05-06 10:23:38.461299', 'tags_are_applied_in_contexts', NULL, 0, NULL, null, null, null, null, null, null, null, null,
- ut3_develop.ut_varchar2_rows('context_tag'), null),
- ut3_develop.ut_suite_cache_row(
- 3, 'UT_TEST', 'some.path.test_tags.nested_context_#1.create_new_mapping', 'TEST_USER', 'TEST_TAGS', 'CREATE_NEW_MAPPING', 11, timestamp '2026-05-06 10:23:38.461299', NULL, NULL, 0, NULL, null, null, null, null, null, null, null, null,
- ut3_develop.ut_varchar2_rows('test_tag'), ut3_develop.ut_executable_test('UT_EXECUTABLE_TEST', 'test', 'TEST_USER', 'test_tags', 'create_new_mapping', NULL, NULL, NULL, NULL))
- );
-
- ut.expect(ut3_develop.ut_suite_tag_filter.apply( l_input_data, 'slow').count).to_equal(3 );
-
- open l_expected for select * from table( l_input_data );
- open l_actual for select * from table( ut3_develop.ut_suite_tag_filter.apply( l_input_data, 'slow') );
- ut.expect(l_actual).to_equal(l_expected).join_by('ID');
-
- ut.expect( ut3_develop.ut_suite_tag_filter.apply(l_input_data, '!slow').count ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.apply(l_input_data, 'bad').count ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.apply(l_input_data, '!bad').count ).to_equal(3);
- ut.expect( ut3_develop.ut_suite_tag_filter.apply(l_input_data, '!context_tag').count ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.apply(l_input_data, 'context_tag').count ).to_equal(3);
- ut.expect( ut3_develop.ut_suite_tag_filter.apply(l_input_data, '!test_tag').count ).to_equal(0);
- ut.expect( ut3_develop.ut_suite_tag_filter.apply(l_input_data, 'test_tag').count ).to_equal(3);
+ l_paths ut3_develop.ut_path_items;
+ l_suites ut3_develop.ut_suite_items;
+ l_items ut3_develop.ut_suite_cache_rows;
+ l_expected sys_refcursor;
+ l_actual sys_refcursor;
+
+ --suite items selected by the tag expression, without the logical suites "some" and "some.path"
+ function get_items(a_tags varchar2) return ut3_develop.ut_suite_cache_rows is
+ l_rows ut3_develop.ut_suite_cache_rows;
+ l_result ut3_develop.ut_suite_cache_rows;
+ begin
+ l_rows := ut3_develop.ut_suite_cache_manager.get_suite_rows( l_paths, true, a_tags );
+ select value(r) bulk collect into l_result from table(l_rows) r where r.self_type != 'UT_LOGICAL_SUITE';
+ return l_result;
+ end;
+ begin
+ --refresh the suite cache of the schema
+ l_suites := ut3_develop.ut_suite_manager.configure_execution_by_path(ut3_develop.ut_varchar2_list('ut3_tester.test_tags_1324'));
+ l_paths := ut3_develop.ut_suite_cache_manager.get_schema_paths(ut3_develop.ut_varchar2_list('ut3_tester.test_tags_1324'));
+
+ l_items := get_items('slow');
+ ut.expect( l_items.count ).to_equal(3);
+
+ open l_expected for
+ select 'some.path.test_tags_1324' as path from dual union all
+ select 'some.path.test_tags_1324.nested_context_#1' from dual union all
+ select 'some.path.test_tags_1324.nested_context_#1.create_new_mapping' from dual;
+ open l_actual for select r.path from table( l_items ) r;
+ ut.expect(l_actual).to_equal(l_expected).unordered();
+
+ ut.expect( get_items('!slow').count ).to_equal(0);
+ ut.expect( get_items('bad').count ).to_equal(0);
+ ut.expect( get_items('!bad').count ).to_equal(3);
+ ut.expect( get_items('!context_tag').count ).to_equal(0);
+ ut.expect( get_items('context_tag').count ).to_equal(3);
+ ut.expect( get_items('!test_tag').count ).to_equal(0);
+ ut.expect( get_items('test_tag').count ).to_equal(3);
end;
end test_ut_suite_tag_filter;
diff --git a/test/ut3_tester/core/test_ut_suite_tag_filter.pks b/test/ut3_tester/core/test_ut_suite_tag_filter.pks
index e7b255d4b..92c8cc744 100644
--- a/test/ut3_tester/core/test_ut_suite_tag_filter.pks
+++ b/test/ut3_tester/core/test_ut_suite_tag_filter.pks
@@ -5,35 +5,98 @@ create or replace package test_ut_suite_tag_filter is
--%context( Conversion to Reverse Polish Notation)
- --%test( Test conversion of expression into Reverse Polish Notation)
- procedure test_conversion_to_rpn;
+ --%test( Test conversion of expression into Reverse Polish Notation)
+ procedure test_conversion_to_rpn;
- --%test( Operator is followed by operator)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_opr_by_opr;
+ --%test( Operator is followed by operator)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure test_conversion_opr_by_opr;
- --%test( Operand is followed by operand)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_oprd_by_opd;
+ --%test( Operand is followed by operand)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure test_conversion_oprd_by_opd;
- --%test( Left Bracket is followed by operator)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_lb_by_oper;
+ --%test( Left Bracket is followed by operator)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure test_conversion_lb_by_oper;
- --%test( Right Bracket is followed by operand)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure test_conversion_rb_by_oprd;
+ --%test( Right Bracket is followed by operand)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure test_conversion_rb_by_oprd;
- --%test(Conversion raises exception when empty brackets)
- --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
- procedure conversion_throws_when_lb_rb;
+ --%test(Conversion raises exception when empty brackets)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure conversion_throws_when_lb_rb;
+
+ --%test(Conversion raises exception when a right bracket has no left bracket)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure conversion_throws_when_unmatched_rb;
+
+ --%test(Conversion raises exception for an empty list of tokens)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure conversion_throws_when_empty;
+
+ --%test(Conversion raises exception when the expression ends with an operator)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure conversion_throws_when_trailing_opr;
+
+ --%test(Tokenizing an empty string returns no tokens)
+ procedure tokenize_empty_string;
--%endcontext
- --%test( Test conversion of expression from tag into custom where filter for SQL)
- procedure conv_from_tag_to_sql_filter;
+ --%test( Evaluates or, and and not in tag expressions)
+ procedure is_matching_or_and_not;
+
+ --%test( Evaluates tag expressions against a list of tags)
+ procedure is_matching_evaluates_tags;
+
+ --%test( Evaluates none and any for items without tags)
+ procedure is_matching_without_tags;
+
+ --%test( Applies operator precedence, brackets and double negation)
+ procedure is_matching_operator_precedence;
+
+ --%test( Combines none and any with other tags)
+ procedure is_matching_none_and_any_combined;
+
+ --%test( Compares tags and the none and any keywords case sensitively)
+ procedure is_matching_is_case_sensitive;
+
+ --%test( Ignores spaces and tabs in the tag expression)
+ procedure is_matching_ignores_whitespace;
+
+ --%test( Matches any tags when the tag expression is empty or made of spaces and tabs)
+ procedure is_matching_empty_expression;
+
+ --%test( Removes spaces and tabs from a tag expression, returning null for one made only of them)
+ procedure remove_whitespace_from_expression;
+
+ --%test( Evaluates a tag containing a quote)
+ procedure is_matching_tag_with_quote;
+
+ --%test( Evaluates an expression with many tags)
+ procedure is_matching_many_tags;
+
+ --%test( Follows three-valued logic for an empty element in the list of tags)
+ procedure is_matching_null_tag_element;
+
+ --%test( Evaluates the current expression after the expression changes or an invalid expression is given)
+ procedure is_matching_follows_expression_change;
+
+ --%test( Raises exception for an invalid tag expression)
+ --%throws(ut3_develop.ut_utils.gc_invalid_tag_expression)
+ procedure is_matching_invalid_expression;
+
+ --%test( Raises exception for an incomplete tag expression)
+ procedure is_matching_incomplete_expression;
+
+ procedure create_tags_suite;
+ procedure drop_tags_suite;
--%test( Regression for issue #1324 - corect filtering by tags with suitepath and contexts)
+ --%beforetest(create_tags_suite)
+ --%aftertest(drop_tags_suite)
procedure filtering_is_correctly_applied_to_all_items;
end test_ut_suite_tag_filter;
diff --git a/test/ut3_tester/core/test_ut_utils.pkb b/test/ut3_tester/core/test_ut_utils.pkb
index 4dc10492b..d46835f66 100644
--- a/test/ut3_tester/core/test_ut_utils.pkb
+++ b/test/ut3_tester/core/test_ut_utils.pkb
@@ -287,7 +287,7 @@ end;';
l_varchar2_byte_limit integer := 32767;
l_workaround_byte_limit integer := 8191;
l_singlebyte_string_max_size varchar2(32767 char) := rpad('x',l_varchar2_byte_limit,'x');
- l_twobyte_character char(1 char) := 'οΏ½?';
+ l_twobyte_character char(1 char) := unistr('\00E4');
l_clob_multibyte clob := l_twobyte_character||l_singlebyte_string_max_size; --here we have 32769(2+32767) bytes and 32768 chars
l_expected ut3_develop.ut_varchar2_list := ut3_develop.ut_varchar2_list();
l_result ut3_develop.ut_varchar2_list;
diff --git a/test/ut3_tester/core/test_ut_utils.pks b/test/ut3_tester/core/test_ut_utils.pks
index ca2e7b304..82145f908 100644
--- a/test/ut3_tester/core/test_ut_utils.pks
+++ b/test/ut3_tester/core/test_ut_utils.pks
@@ -93,7 +93,6 @@ create or replace package test_ut_utils is
procedure clean_append_with_multibyte;
--%test(clob_to_table - converts multibyte CLOB to ut_varchar2_list)
- --%disabled(We cannot run this test successfully on 12.1 until we change NLSCHARACTERSET from US7ASCII to AL32UTF8)
procedure test_clob_to_table_multibyte;
--%test(to_version - splits version string into individual version components)
diff --git a/test/ut3_tester_helper/annotation_cache_helper.pkb b/test/ut3_tester_helper/annotation_cache_helper.pkb
index 0715b6af1..63e20159d 100644
--- a/test/ut3_tester_helper/annotation_cache_helper.pkb
+++ b/test/ut3_tester_helper/annotation_cache_helper.pkb
@@ -90,6 +90,67 @@ create or replace package body annotation_cache_helper as
end;
end;
+ /*
+ Suites spread across packages, only child_suite is granted:
+ parent_suite package parent_suite, not granted, tagged parent_tag
+ parent_suite.child_suite package child_suite, granted
+ hidden_path.sub.lone_suite package lone_suite, not granted, below logical suites hidden_path and hidden_path.sub
+ */
+ procedure setup_suite_hierarchy is
+ pragma autonomous_transaction;
+ begin
+ execute immediate
+ 'create or replace package ut3_cache_test_owner.parent_suite authid definer is
+ --%suite
+ --%tags(parent_tag)
+
+ --%test
+ procedure parent_test;
+ end;';
+ execute immediate
+ 'create or replace package body ut3_cache_test_owner.parent_suite is
+ procedure parent_test is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
+ end;';
+ execute immediate
+ 'create or replace package ut3_cache_test_owner.child_suite authid definer is
+ --%suite
+ --%suitepath(parent_suite)
+
+ --%test
+ procedure child_test;
+ end;';
+ execute immediate
+ 'create or replace package body ut3_cache_test_owner.child_suite is
+ procedure child_test is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
+ end;';
+ execute immediate
+ 'create or replace package ut3_cache_test_owner.lone_suite authid definer is
+ --%suite
+ --%suitepath(hidden_path.sub)
+
+ --%test
+ procedure lone_test;
+ end;';
+ execute immediate
+ 'create or replace package body ut3_cache_test_owner.lone_suite is
+ procedure lone_test is begin ut3_develop.ut.expect( 1 ).to_equal( 1 ); end;
+ end;';
+ execute immediate 'grant execute on ut3_cache_test_owner.child_suite to ut3_no_extra_priv_user';
+ end;
+
+ procedure cleanup_suite_hierarchy is
+ pragma autonomous_transaction;
+ begin
+ for i in ( select column_value as package_name from table(ut3_develop.ut_varchar2_list('parent_suite','child_suite','lone_suite')) ) loop
+ begin
+ execute immediate 'drop package ut3_cache_test_owner.'||i.package_name;
+ exception
+ when others then
+ null;
+ end;
+ end loop;
+ end;
+
procedure cleanup_new_suite is
pragma autonomous_transaction;
begin
@@ -122,21 +183,34 @@ create or replace package body annotation_cache_helper as
pragma autonomous_transaction;
begin
execute immediate
- 'create or replace function ' || a_user || '.call_ut_run return clob is
+ 'create or replace function ' || a_user || '.call_ut_run(a_path varchar2 := ''ut3_cache_test_owner'', a_tags varchar2 := null) return clob is
l_data ut3_develop.ut_varchar2_list;
l_results clob;
begin
- select * bulk collect into l_data from table (ut3_develop.ut.run( ''ut3_cache_test_owner'' ));
+ select * bulk collect into l_data from table (ut3_develop.ut.run( a_path, a_tags => a_tags ));
return ut3_tester_helper.main_helper.table_to_clob( l_data );
end;
';
execute immediate 'grant execute on ' || a_user || '.call_ut_run to public ';
+ execute immediate
+ 'create or replace function ' || a_user || '.call_suites_info return clob is
+ l_data ut3_develop.ut_varchar2_list;
+ begin
+ select i.item_type || '' '' || i.path
+ bulk collect into l_data
+ from table (ut3_develop.ut_runner.get_suites_info( ''UT3_CACHE_TEST_OWNER'' )) i
+ order by i.path;
+ return ut3_tester_helper.main_helper.table_to_clob( l_data );
+ end;
+ ';
+ execute immediate 'grant execute on ' || a_user || '.call_suites_info to public ';
end;
procedure drop_run_function_for_user(a_user varchar2) is
pragma autonomous_transaction;
begin
execute immediate 'drop function ' || a_user || '.call_ut_run';
+ execute immediate 'drop function ' || a_user || '.call_suites_info';
end;
procedure create_run_function_for_users is
@@ -159,10 +233,17 @@ create or replace package body annotation_cache_helper as
drop_run_function_for_user( 'ut3_develop' );
end;
- function run_tests_as(a_user varchar2) return clob is
+ function run_tests_as(a_user varchar2, a_path varchar2 := 'ut3_cache_test_owner', a_tags varchar2 := null) return clob is
+ l_results clob;
+ begin
+ execute immediate 'begin :x := '||a_user||'.call_ut_run(:a_path, :a_tags); end;' using out l_results, a_path, a_tags;
+ return l_results;
+ end;
+
+ function get_suites_info_as(a_user varchar2) return clob is
l_results clob;
begin
- execute immediate 'begin :x := '||a_user||'.call_ut_run; end;' using out l_results;
+ execute immediate 'begin :x := '||a_user||'.call_suites_info; end;' using out l_results;
return l_results;
end;
end;
diff --git a/test/ut3_tester_helper/annotation_cache_helper.pks b/test/ut3_tester_helper/annotation_cache_helper.pks
index d6ab1f8e2..88b82d872 100644
--- a/test/ut3_tester_helper/annotation_cache_helper.pks
+++ b/test/ut3_tester_helper/annotation_cache_helper.pks
@@ -12,10 +12,14 @@ create or replace package annotation_cache_helper as
procedure disable_ddl_trigger;
procedure enable_ddl_trigger;
+ procedure setup_suite_hierarchy;
+ procedure cleanup_suite_hierarchy;
+
procedure create_run_function_for_users;
procedure drop_run_function_for_users;
- function run_tests_as(a_user varchar2) return clob;
+ function run_tests_as(a_user varchar2, a_path varchar2 := 'ut3_cache_test_owner', a_tags varchar2 := null) return clob;
+ function get_suites_info_as(a_user varchar2) return clob;
end;
/
\ No newline at end of file
diff --git a/test/ut3_tester_helper/coverage_helper.pkb b/test/ut3_tester_helper/coverage_helper.pkb
index ef14c586f..8c978d046 100644
--- a/test/ut3_tester_helper/coverage_helper.pkb
+++ b/test/ut3_tester_helper/coverage_helper.pkb
@@ -2,22 +2,9 @@ create or replace package body coverage_helper is
g_job_no integer := 0;
- function block_coverage_available return boolean is
- begin
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- return true;
- $else
- return false;
- $end
- end;
-
function covered_package_name return varchar2 is
begin
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- return 'dummy_coverage_package_with_an_amazingly_long_name_that_you_would_not_think_of_in_real_life_project_because_its_simply_too_long';
- $else
- return 'dummy_coverage';
- $end
+ return 'dummy_coverage_package_with_an_amazingly_long_name_that_you_would_not_think_of_in_real_life_project_because_its_simply_too_long';
end;
function substitute_covered_package( a_text varchar2, a_substitution varchar2 ) return varchar2 is
@@ -314,7 +301,7 @@ create or replace package body coverage_helper is
begin
g_job_no := g_job_no + 1;
l_job_name := 'utPLSQL_selftest_job_'||g_job_no;
- dbms_lock.sleep(0.15);
+ dbms_session.sleep(0.15);
dbms_scheduler.create_job(
job_name => l_job_name,
job_type => 'PLSQL_BLOCK',
@@ -326,7 +313,7 @@ create or replace package body coverage_helper is
);
while (l_job_run_info.status is null or l_job_run_info.status not in ('SUCCEEDED','FAILED')) and i < 6000 loop
l_job_run_info := get_job_status( l_job_name, l_timestamp );
- dbms_lock.sleep(0.1);
+ dbms_session.sleep(0.1);
i := i + 1;
end loop;
commit;
@@ -369,7 +356,7 @@ create or replace package body coverage_helper is
pragma autonomous_transaction;
begin
run_job_and_wait_for_finish( a_plsql_block );
- dbms_lock.sleep(0.1);
+ dbms_session.sleep(0.1);
execute immediate q'[
declare
l_results ut3_develop.ut_varchar2_list;
diff --git a/test/ut3_tester_helper/coverage_helper.pks b/test/ut3_tester_helper/coverage_helper.pks
index 8d2c1c150..d6a57a143 100644
--- a/test/ut3_tester_helper/coverage_helper.pks
+++ b/test/ut3_tester_helper/coverage_helper.pks
@@ -1,7 +1,5 @@
create or replace package coverage_helper is
- function block_coverage_available return boolean;
-
function covered_package_name return varchar2;
function substitute_covered_package( a_text varchar2, a_substitution varchar2 := '{p}' ) return varchar2;
diff --git a/test/ut3_tester_helper/run_helper.pkb b/test/ut3_tester_helper/run_helper.pkb
index c56f31dc0..6bd88bfa8 100644
--- a/test/ut3_tester_helper/run_helper.pkb
+++ b/test/ut3_tester_helper/run_helper.pkb
@@ -146,6 +146,28 @@ create or replace package body run_helper is
ut3_develop.ut_annotation_manager.rebuild_annotation_cache('UT3_TESTER_HELPER','PROCEDURE');
end;
+ procedure setup_cache_context_disabled is
+ pragma autonomous_transaction;
+ begin
+ --the procedures that cleanup_cache drops
+ setup_cache_objects();
+ execute immediate q'[create or replace package ut3_user.dummy_test_package as
+ --%suite(dummy_test_suite)
+ --%suitepath(some.path)
+
+ --%test(dummy_test)
+ procedure some_dummy_test_procedure;
+
+ --%context(dummy_context)
+
+ --%test(disabled_test)
+ --%disabled(not ready)
+ procedure disabled_test_procedure;
+
+ --%endcontext
+ end;]';
+ end;
+
procedure cleanup_cache is
pragma autonomous_transaction;
begin
diff --git a/test/ut3_tester_helper/run_helper.pks b/test/ut3_tester_helper/run_helper.pks
index 6c5dd4a3b..c46b99a3f 100644
--- a/test/ut3_tester_helper/run_helper.pks
+++ b/test/ut3_tester_helper/run_helper.pks
@@ -7,6 +7,7 @@ create or replace package run_helper is
procedure setup_cache_objects;
procedure setup_cache_objectstag;
procedure setup_cache_twotags;
+ procedure setup_cache_context_disabled;
procedure setup_cache;
procedure cleanup_cache;
procedure create_db_link;
diff --git a/test/ut3_user/api/test_ut_run.pkb b/test/ut3_user/api/test_ut_run.pkb
index b4040bb43..12ab6cdba 100644
--- a/test/ut3_user/api/test_ut_run.pkb
+++ b/test/ut3_user/api/test_ut_run.pkb
@@ -23,6 +23,45 @@ create or replace package body test_ut_run is
ut3_tester_helper.run_helper.drop_ut3_user_tests();
end;
+ --a suite on suitepath "tests", as test_package_1 in ut3_tester_helper (see run_helper.create_ut3_user_tests)
+ procedure create_test_suite_in_ut3_user is
+ pragma autonomous_transaction;
+ begin
+ execute immediate q'[create or replace package test_suite_in_ut3_user is
+ --%suite
+ --%suitepath(tests)
+
+ --%test
+ procedure test1;
+ end;]';
+ execute immediate q'[create or replace package body test_suite_in_ut3_user is
+ procedure test1 is
+ begin
+ dbms_output.put_line('test_suite_in_ut3_user.test1 executed');
+ end;
+ end;]';
+ end;
+
+ procedure drop_test_suite_in_ut3_user is
+ pragma autonomous_transaction;
+ begin
+ execute immediate 'drop package test_suite_in_ut3_user';
+ end;
+
+ procedure run_groups_suites_by_schema is
+ l_results clob;
+ begin
+ --Act - ut3_user:tests sorts between ut3_tester_helper:tests and ut3_tester_helper:tests2 by path
+ l_results := ut3_tester_helper.main_helper.table_to_clob(
+ ut3_tester_helper.run_helper.run(
+ ut3_develop.ut_varchar2_list('ut3_user:tests', 'ut3_tester_helper:tests', 'ut3_tester_helper:tests2'),
+ a_tags => null
+ )
+ );
+ --Assert - UT3_TESTER_HELPER comes before UT3_USER
+ ut.expect( l_results ).to_be_like( '%test_package_2.test1 executed%test_package_3.test1 executed%test_suite_in_ut3_user.test1 executed%' );
+ end;
+
procedure ut_version is
begin
ut.expect(ut3_develop.ut.version()).to_match('^v\d+\.\d+\.\d+\.\d+(-\w+)?$');
@@ -551,7 +590,7 @@ Failures:%
ORA-04068: existing state of packages (DB_LOOPBACK%) has been discarded
ORA-04061: existing state of package body "%.STATEFUL_PACKAGE" has been invalidated
ORA-04065: not executed, altered or dropped package body "%.STATEFUL_PACKAGE"%
- ORA-06512: at line 6%
+ ORA-06512: at line 7%
1 tests, 0 failed, 1 errored, 0 disabled, 0 warning(s)%';
--Act
@@ -896,6 +935,38 @@ Failures:%
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
+
+ procedure run_proc_prints_support_info is
+ begin
+ ut3_develop.ut.run('ut3_tester_helper.test_package_1');
+
+ ut.expect( ut3_tester_helper.main_helper.get_dbms_output_as_clob() ).to_be_like( '%' || reporters.gc_support_line || '%' );
+ end;
+
+ procedure run_proc_omits_support_info is
+ begin
+ ut3_develop.ut.run('ut3_tester_helper.test_package_1', a_support_info => false);
+
+ ut.expect( ut3_tester_helper.main_helper.get_dbms_output_as_clob() ).not_to_be_like( '%' || reporters.gc_support_line || '%' );
+ end;
+
+ procedure run_func_prints_support_info is
+ l_results ut3_develop.ut_varchar2_list;
+ begin
+ select * bulk collect into l_results
+ from table ( ut3_develop.ut.run('ut3_tester_helper.test_package_1') );
+
+ ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_be_like( '%' || reporters.gc_support_line || '%' );
+ end;
+
+ procedure run_func_omits_support_info is
+ l_results ut3_develop.ut_varchar2_list;
+ begin
+ select * bulk collect into l_results
+ from table ( ut3_develop.ut.run('ut3_tester_helper.test_package_1', a_support_info => 0) );
+
+ ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like( '%' || reporters.gc_support_line || '%' );
+ end;
procedure test_run_by_one_tag is
l_results clob;
@@ -1296,9 +1367,83 @@ procedure tag_exclude_run_fun_pth_lst_lg is
ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
l_results := ut3_tester_helper.run_helper.run(a_tags => '(development|end_to_end))');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
- ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
+ ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).to_match('^\s*invalid_tag_expression \[[,\.0-9]+ sec\]\s*$','m');
+ ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_results) ).not_to_be_like('%(FAILED -%');
+
+ end;
+
+ procedure invalid_tag_expression_no_tests is
+ l_results ut3_develop.ut_varchar2_list;
+ begin
+ --the package does not exist, so no test is there to evaluate the tag expression on
+ l_results := ut3_tester_helper.run_helper.run('ut3_tester_helper.no_such_test_package', a_tags => '(development|end_to_end))');
+ end;
+ procedure tag_run_pkg_wildcard is
+ l_results clob;
+ begin
+ --test_tag_pkg_3 has no test tagged fast
+ l_results := ut3_tester_helper.main_helper.table_to_clob(
+ ut3_tester_helper.run_helper.run('ut3_tester_helper.test_tag_pkg_*', a_tags => 'fast')
+ );
+ --Assert
+ ut.expect( l_results ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
+ ut.expect( l_results ).to_be_like( '%test_tag_pkg_2.test3 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_1.test2 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_2.test4 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_3%' );
+ end;
+
+ procedure tag_run_proc_wildcard is
+ l_results clob;
+ begin
+ --test_tag_pkg_1.test2 is not tagged fast
+ l_results := ut3_tester_helper.main_helper.table_to_clob(
+ ut3_tester_helper.run_helper.run('ut3_tester_helper.test_tag_pkg_1.test*', a_tags => 'fast')
+ );
+ --Assert
+ ut.expect( l_results ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_1.test2 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_2%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_3%' );
+ end;
+
+ procedure tag_run_suitepath_wildcard is
+ l_results clob;
+ begin
+ --suitepath suite3 (test_tag_pkg_3) has no test tagged fast
+ l_results := ut3_tester_helper.main_helper.table_to_clob(
+ ut3_tester_helper.run_helper.run('ut3_tester_helper:suite*', a_tags => 'fast')
+ );
+ --Assert
+ ut.expect( l_results ).to_be_like( '%test_tag_pkg_1.test1 executed%' );
+ ut.expect( l_results ).to_be_like( '%test_tag_pkg_2.test3 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_1.test2 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_2.test4 executed%' );
+ ut.expect( l_results ).not_to_be_like( '%test_tag_pkg_3%' );
+ end;
+
+ procedure tag_run_wildcard_none_left is
+ l_results ut3_develop.ut_varchar2_list;
+ begin
+ l_results := ut3_tester_helper.run_helper.run('ut3_tester_helper.test_tag_pkg_*', a_tags => 'nonexisting');
+ ut.fail('Expected exception ORA-20204 was not raised');
+ exception
+ when others then
+ ut.expect(sqlerrm).to_be_like('%ORA-20204: Suite package ut3_tester_helper.test_tag_pkg_* does not exist%');
+ end;
+
+ procedure blank_tags_run_all_tests is
+ l_expected ut3_develop.ut_varchar2_list;
+ l_actual ut3_develop.ut_varchar2_list;
+ begin
+ l_expected := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests,:tests2'));
+ l_actual := ut3_tester_helper.run_helper.run(ut3_develop.ut_varchar2_list(':tests,:tests2'), a_tags => ' '||chr(9)||' ');
+
+ remove_time_from_results(l_expected);
+ remove_time_from_results(l_actual);
+ ut.expect( ut3_tester_helper.main_helper.table_to_clob(l_actual) ).to_be_like( '%test_package_1.test1%executed%' );
+ ut.expect( anydata.convertCollection(l_actual) ).to_equal( anydata.convertCollection(l_expected) );
end;
procedure set_application_info is
diff --git a/test/ut3_user/api/test_ut_run.pks b/test/ut3_user/api/test_ut_run.pks
index c57788bff..552c5dbf3 100644
--- a/test/ut3_user/api/test_ut_run.pks
+++ b/test/ut3_user/api/test_ut_run.pks
@@ -181,6 +181,39 @@ create or replace package test_ut_run is
--%endcontext
+ --%context(support_info)
+
+ --%displayname(Support line)
+ --%beforeall(create_ut3_user_tests)
+ --%afterall(drop_ut3_user_tests)
+
+ --%test(ut.run() procedure prints support line by default)
+ procedure run_proc_prints_support_info;
+
+ --%test(ut.run() procedure omits support line when a_support_info is false)
+ procedure run_proc_omits_support_info;
+
+ --%test(ut.run() function prints support line by default)
+ procedure run_func_prints_support_info;
+
+ --%test(ut.run() function omits support line when a_support_info is 0)
+ procedure run_func_omits_support_info;
+
+ --%endcontext
+
+ --%context(run with paths in several schemas)
+
+ --%beforeall(create_ut3_user_tests, create_test_suite_in_ut3_user)
+ --%afterall(drop_test_suite_in_ut3_user, drop_ut3_user_tests)
+
+ --%test(Runs the suites of each schema together, in order of schema names)
+ procedure run_groups_suites_by_schema;
+
+ --%endcontext
+
+ procedure create_test_suite_in_ut3_user;
+ procedure drop_test_suite_in_ut3_user;
+
--%context(run with tags)
--%displayname(Call ut.run with #tags)
@@ -266,6 +299,25 @@ create or replace package test_ut_run is
--%throws(-20219)
procedure invalid_tag_expression;
+ --%test(Raises an error for an invalid tag expression when the path selects no tests)
+ --%throws(-20219)
+ procedure invalid_tag_expression_no_tests;
+
+ --%test(Runs tests matching the tags from packages selected by a wildcard, skipping packages without such tests)
+ procedure tag_run_pkg_wildcard;
+
+ --%test(Runs tests matching the tags from tests selected by a wildcard, skipping the other tests)
+ procedure tag_run_proc_wildcard;
+
+ --%test(Runs tests matching the tags from suitepaths selected by a wildcard, skipping suites without such tests)
+ procedure tag_run_suitepath_wildcard;
+
+ --%test(Raises an error naming the wildcard path when the tags exclude all tests it selects)
+ procedure tag_run_wildcard_none_left;
+
+ --%test(Runs the same tests as without tags when the tag expression is made of spaces and tabs)
+ procedure blank_tags_run_all_tests;
+
--%endcontext
--%context(ut3_info context)
diff --git a/test/ut3_user/api/test_ut_runner.pkb b/test/ut3_user/api/test_ut_runner.pkb
index d665718e1..9ef709e91 100644
--- a/test/ut3_user/api/test_ut_runner.pkb
+++ b/test/ut3_user/api/test_ut_runner.pkb
@@ -25,6 +25,11 @@ create or replace package body test_ut_runner is
ut3_tester_helper.run_helper.cleanup_cache();
end;
+ procedure setup_cache_context_disabled is
+ begin
+ ut3_tester_helper.run_helper.setup_cache_context_disabled();
+ end;
+
procedure create_test_spec
as
pragma autonomous_transaction;
@@ -376,6 +381,80 @@ end;';
ut.expect(l_actual).to_equal(l_expected);
end;
+ procedure test_get_suites_info_context 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,
+ 'some.path.dummy_test_package' path, 0 disabled_flag, null disabled_reason, 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,
+ 'some.path.dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason, null tags
+ from dual union all
+ select
+ 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'NESTED_CONTEXT_#1' item_name,
+ 'dummy_context' item_description, 'UT_SUITE_CONTEXT' item_type, 8 item_line_no,
+ 'some.path.dummy_test_package.nested_context_#1' path, 0 disabled_flag, null disabled_reason, null tags
+ from dual union all
+ select
+ 'UT3_USER' object_owner, 'DUMMY_TEST_PACKAGE' object_name, 'DISABLED_TEST_PROCEDURE' item_name,
+ 'disabled_test' item_description, 'UT_TEST' item_type, 10 item_line_no,
+ 'some.path.dummy_test_package.nested_context_#1.disabled_test_procedure' path, 1 disabled_flag, 'not ready' disabled_reason, null tags
+ from dual union all
+ select
+ 'UT3_USER' object_owner, 'PATH' object_name, 'PATH' item_name,
+ null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
+ 'some.path' path, 0 disabled_flag, null disabled_reason, null tags
+ from dual union all
+ select
+ 'UT3_USER' object_owner, 'SOME' object_name, 'SOME' item_name,
+ null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
+ 'some' path, 0 disabled_flag, null disabled_reason, null tags
+ from dual;
+ --Act
+ open l_actual for select * from table(ut3_develop.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_by_proc 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,
+ 'some.path.dummy_test_package' path, 0 disabled_flag, null disabled_reason, 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, 6 item_line_no,
+ 'some.path.dummy_test_package.some_dummy_test_procedure' path, 0 disabled_flag, null disabled_reason, null tags
+ from dual union all
+ select
+ 'UT3_USER' object_owner, 'PATH' object_name, 'PATH' item_name,
+ null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
+ 'some.path' path, 0 disabled_flag, null disabled_reason, null tags
+ from dual union all
+ select
+ 'UT3_USER' object_owner, 'SOME' object_name, 'SOME' item_name,
+ null item_description, 'UT_LOGICAL_SUITE' item_type, null item_line_no,
+ 'some' path, 0 disabled_flag, null disabled_reason, null tags
+ from dual;
+ --Act
+ open l_actual for select * from table(ut3_develop.ut_runner.get_suites_info('ut3_user.dummy_test_package.some_dummy_test_procedure'));
+ --Assert
+ ut.expect(l_actual).to_equal(l_expected);
+ end;
+
procedure test_get_reporters_list is
l_expected sys_refcursor;
l_actual sys_refcursor;
@@ -386,7 +465,6 @@ end;';
select 'UT3_DEVELOP.UT_DEBUG_REPORTER', 'Y' from dual union all
select 'UT3_DEVELOP.UT_COVERAGE_HTML_REPORTER', 'Y' from dual union all
select 'UT3_DEVELOP.UT_COVERAGE_SONAR_REPORTER', 'Y' from dual union all
- select 'UT3_DEVELOP.UT_COVERALLS_REPORTER', 'Y' from dual union all
select 'UT3_DEVELOP.UT_DOCUMENTATION_REPORTER', 'Y' from dual union all
select 'UT3_DEVELOP.UT_JUNIT_REPORTER', 'Y' from dual union all
select 'UT3_DEVELOP.UT_REALTIME_REPORTER', 'Y' from dual union all
diff --git a/test/ut3_user/api/test_ut_runner.pks b/test/ut3_user/api/test_ut_runner.pks
index e003ba852..742d4ad1c 100644
--- a/test/ut3_user/api/test_ut_runner.pks
+++ b/test/ut3_user/api/test_ut_runner.pks
@@ -70,6 +70,18 @@ create or replace package test_ut_runner is
--%aftertest(cleanup_cache)
procedure test_get_suites_info_by_path;
+ procedure setup_cache_context_disabled;
+
+ --%test(get_suites_info returns contexts and disabled tests)
+ --%beforetest(setup_cache_context_disabled)
+ --%aftertest(cleanup_cache)
+ procedure test_get_suites_info_context;
+
+ --%test(get_suites_info returns a test and its parents for a procedure path)
+ --%beforetest(setup_cache_objects)
+ --%aftertest(cleanup_cache)
+ procedure test_get_suites_info_by_proc;
+
--%test(get_reporters_list returns a cursor containing all built-in reporters and information about output-reporter)
--%beforetest(setup_cache_objects)
--%aftertest(cleanup_cache)
diff --git a/test/ut3_user/expectations/binary/test_to_be_within.pkb b/test/ut3_user/expectations/binary/test_to_be_within.pkb
index 032b684a5..c9aae6ee2 100644
--- a/test/ut3_user/expectations/binary/test_to_be_within.pkb
+++ b/test/ut3_user/expectations/binary/test_to_be_within.pkb
@@ -199,7 +199,7 @@ create or replace package body test_to_be_within is
begin
--Arrange
--Act
- ut3_develop.ut.expect(sysdate).to_be_within(INTERVAL '1' MONTH).of_(sysdate+ 46);
+ ut3_develop.ut.expect(sysdate).to_be_within(INTERVAL '1' MONTH).of_(sysdate+ 47);
--Assert
l_expected_message := q'[Actual: % (date) was expected to be within 1 month of % (date)]';
l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
diff --git a/test/ut3_user/expectations/test_expectation_anydata.pkb b/test/ut3_user/expectations/test_expectation_anydata.pkb
index c70d41f9e..5f76e6715 100644
--- a/test/ut3_user/expectations/test_expectation_anydata.pkb
+++ b/test/ut3_user/expectations/test_expectation_anydata.pkb
@@ -1229,7 +1229,6 @@ Rows: [ 60 differences, showing first 20 ]
end;
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
procedure long_names_object_types is
pragma autonomous_transaction;
begin
@@ -1253,7 +1252,6 @@ Rows: [ 60 differences, showing first 20 ]
execute immediate 'drop type very_long_type_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it';
raise;
end;
- $end
end;
/
\ No newline at end of file
diff --git a/test/ut3_user/expectations/test_expectation_anydata.pks b/test/ut3_user/expectations/test_expectation_anydata.pks
index 54c246bd3..557eb58db 100644
--- a/test/ut3_user/expectations/test_expectation_anydata.pks
+++ b/test/ut3_user/expectations/test_expectation_anydata.pks
@@ -237,10 +237,8 @@ create or replace package test_expectation_anydata is
--%test ( Reports success when comparing complex nested objects )
procedure complex_nested_object_success;
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
--%test ( Compares object types with long names - Issue #1235 )
procedure long_names_object_types;
- $end
end;
/
diff --git a/test/ut3_user/expectations/test_expectations_cursor.pkb b/test/ut3_user/expectations/test_expectations_cursor.pkb
index a4ef4e8f2..aa5375500 100644
--- a/test/ut3_user/expectations/test_expectations_cursor.pkb
+++ b/test/ut3_user/expectations/test_expectations_cursor.pkb
@@ -2843,8 +2843,6 @@ Check the query and data for errors.';
l_expected_data(1).col4 := 2016;
l_expected_data(1).col5 := -1;
- --Select on package level nested table types supported only since Oracle 12
- $if dbms_db_version.version >= 12 $then
open l_expected for
select *
from table (l_expected_data);
@@ -2869,7 +2867,6 @@ Check the query and data for errors.';
l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
ut.expect(l_actual_message).to_be_like(l_expected_message);
- $end
end;
procedure uc_columns_exclude is
@@ -2890,19 +2887,57 @@ Check the query and data for errors.';
l_expected sys_refcursor;
begin
-- populate actual
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- open l_actual for
- select rownum as id, '1' some_column_with_a_pretty_long_enough_name from dual;
+ open l_actual for
+ select rownum as id, '1' some_column_with_a_pretty_long_enough_name from dual;
- open l_expected for
- select rownum as id, '1' some_column_with_a_pretty_long_enough_name from dual;
+ open l_expected for
+ select rownum as id, '1' some_column_with_a_pretty_long_enough_name from dual;
- ut3_develop.ut.expect(l_actual).to_equal(l_expected).include('ID,SOME_COLUMN_WITH_A_PRETTY_LONG_ENOUGH_NAME').join_by('ID');
- --Assert
- ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
- $else
- null;
- $end
+ ut3_develop.ut.expect(l_actual).to_equal(l_expected).include('ID,SOME_COLUMN_WITH_A_PRETTY_LONG_ENOUGH_NAME').join_by('ID');
+ --Assert
+ ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
+ end;
+
+ procedure compare_column_names_over_max_identifier is
+ l_actual sys_refcursor;
+ l_expected sys_refcursor;
+ --An unaliased literal gets a column name longer than an identifier can be
+ l_sql varchar2(4000) := 'select '''||rpad('a',ora_max_name_len_supported + 10,'a')||''' from dual';
+ begin
+ --Act
+ open l_actual for l_sql;
+ open l_expected for l_sql;
+ ut3_develop.ut.expect(l_actual).to_equal(l_expected);
+ --Assert
+ ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
+
+ --Act
+ open l_actual for l_sql;
+ open l_expected for l_sql||' connect by level <= 2';
+ ut3_develop.ut.expect(l_actual).to_equal(l_expected);
+ --Assert
+ ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(1);
+ end;
+
+ procedure compare_varchar2_described_over_4000 is
+ l_actual sys_refcursor;
+ l_expected sys_refcursor;
+ --A dynamic bind longer than 4000 chars is described as a varchar2 longer than 4000, even with max_string_size=standard
+ c_sql constant varchar2(100) := 'select :some_text as some_text from dual';
+ begin
+ --Act
+ open l_actual for c_sql using rpad('x',4001,'x');
+ open l_expected for c_sql using rpad('x',4001,'x');
+ ut3_develop.ut.expect(l_actual).to_equal(l_expected);
+ --Assert
+ ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
+
+ --Act
+ open l_actual for c_sql using rpad('x',4001,'x');
+ open l_expected for c_sql using rpad('y',4001,'y');
+ ut3_develop.ut.expect(l_actual).to_equal(l_expected);
+ --Assert
+ ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(1);
end;
procedure compare_specific_column_names is
diff --git a/test/ut3_user/expectations/test_expectations_cursor.pks b/test/ut3_user/expectations/test_expectations_cursor.pks
index 8cceb5e01..d7ff823de 100644
--- a/test/ut3_user/expectations/test_expectations_cursor.pks
+++ b/test/ut3_user/expectations/test_expectations_cursor.pks
@@ -479,6 +479,12 @@ create or replace package test_expectations_cursor is
--%test( Compares cursors with long column names - Issue #952 )
procedure compare_long_column_names;
+ --%test( Compares cursors with column names longer than the maximum identifier length )
+ procedure compare_column_names_over_max_identifier;
+
+ --%test( Compares cursors with varchar2 columns described as longer than 4000 )
+ procedure compare_varchar2_described_over_4000;
+
--%test( Compares cursors with specific column names - Issue #997 )
procedure compare_specific_column_names;
diff --git a/test/ut3_user/reporters.pks b/test/ut3_user/reporters.pks
index c5ad72e22..412091984 100644
--- a/test/ut3_user/reporters.pks
+++ b/test/ut3_user/reporters.pks
@@ -1,5 +1,7 @@
create or replace package reporters is
+ gc_support_line constant varchar2(200) := 'Using utPLSQL at work? Get support and help keep it maintained: https://utplsql.org/support';
+
--%suite
--%suitepath(utplsql.test_user)
diff --git a/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb b/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb
index ad6c9dbb4..49e0410ba 100644
--- a/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb
+++ b/test/ut3_user/reporters/test_coverage/test_cov_cobertura_reporter.pkb
@@ -12,11 +12,7 @@ create or replace package body test_cov_cobertura_reporter is
--Arrange
l_name := ut3_tester_helper.coverage_helper.covered_package_name;
l_file_path := 'test/ut3_develop.'||ut3_tester_helper.coverage_helper.covered_package_name||'.pkb';
- if ut3_tester_helper.coverage_helper.block_coverage_available then
- l_block_cov := '';
- else
- l_block_cov := '';
- end if;
+ l_block_cov := '';
l_expected :=
q'[
diff --git a/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb b/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb
index 50d7bfe4c..9f2409637 100644
--- a/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb
+++ b/test/ut3_user/reporters/test_coverage/test_coverage_sonar_reporter.pkb
@@ -6,11 +6,7 @@ create or replace package body test_coverage_sonar_reporter is
l_block_cov clob;
begin
--Arrange
- if ut3_tester_helper.coverage_helper.block_coverage_available then
- l_block_cov := '';
- else
- l_block_cov := '';
- end if;
+ l_block_cov := '';
l_expected := '
diff --git a/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pkb b/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pkb
index 90cfb484e..adf7b51d1 100644
--- a/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pkb
+++ b/test/ut3_user/reporters/test_coverage/test_coverage_standalone.pkb
@@ -7,11 +7,7 @@ create or replace package body test_coverage_standalone is
begin
l_file_path := 'package body ut3_develop.'||a_object_name;
--Arrange
- if ut3_tester_helper.coverage_helper.block_coverage_available then
- l_block_cov := '';
- else
- l_block_cov := '';
- end if;
+ l_block_cov := '';
l_expected :=
q'[
diff --git a/test/ut3_user/reporters/test_coverage/test_coveralls_reporter.pkb b/test/ut3_user/reporters/test_coverage/test_coveralls_reporter.pkb
deleted file mode 100644
index e3806cd97..000000000
--- a/test/ut3_user/reporters/test_coverage/test_coveralls_reporter.pkb
+++ /dev/null
@@ -1,77 +0,0 @@
-create or replace package body test_coveralls_reporter is
-
- procedure report_on_file is
- l_expected clob;
- l_actual clob;
- l_file_path varchar2(250);
- begin
- --Arrange
- l_file_path := 'test/ut3_develop.'||ut3_tester_helper.coverage_helper.covered_package_name||'.pkb';
- l_expected := q'[{"source_files":[
-{ "name": "]'||l_file_path||q'[",
-"coverage": [
-null,
-null,
-null,
-3,
-null,
-0
-]
-}
-]}
- ]';
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- a_path => 'ut3_develop.test_dummy_coverage',
- a_reporter => ut3_develop.ut_coveralls_reporter( ),
- a_source_files => ut3_develop.ut_varchar2_list( ']'||l_file_path||q'[' ),
- a_test_files => ut3_develop.ut_varchar2_list( )
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
- end;
-
- procedure report_zero_coverage is
- l_expected clob;
- l_actual clob;
- begin
- --Arrange
- l_expected := q'[{"source_files":[
-{ "name": "package body ut3_develop.]'||ut3_tester_helper.coverage_helper.covered_package_name||q'[",
-"coverage": [
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0
-]
-}
-]}
- ]';
-
- --Act
- l_actual :=
- ut3_tester_helper.coverage_helper.run_tests_as_job(
- q'[
- ut3_develop.ut.run(
- 'ut3_develop.test_dummy_coverage.zero_coverage',
- ut3_develop.ut_coveralls_reporter(),
- a_include_objects => ut3_develop.ut_varchar2_list('UT3_DEVELOP.]'||ut3_tester_helper.coverage_helper.covered_package_name||q'[')
- )
- ]'
- );
- --Assert
- ut.expect(l_actual).to_equal(l_expected);
-
- end;
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_coveralls_reporter.pks b/test/ut3_user/reporters/test_coverage/test_coveralls_reporter.pks
deleted file mode 100644
index d958b8f12..000000000
--- a/test/ut3_user/reporters/test_coverage/test_coveralls_reporter.pks
+++ /dev/null
@@ -1,13 +0,0 @@
-create or replace package test_coveralls_reporter is
-
- --%suite(ut_coveralls_reporter)
- --%suitepath(utplsql.test_user.reporters.test_coverage)
-
- --%test(reports on a project file mapped to database object)
- procedure report_on_file;
-
- --%test(reports zero coverage on each line of non-executed database object)
- procedure report_zero_coverage;
-
-end;
-/
diff --git a/test/ut3_user/reporters/test_coverage/test_extended_coverage.pkb b/test/ut3_user/reporters/test_coverage/test_extended_coverage.pkb
index d7f1b61d7..f6f76b62f 100644
--- a/test/ut3_user/reporters/test_coverage/test_extended_coverage.pkb
+++ b/test/ut3_user/reporters/test_coverage/test_extended_coverage.pkb
@@ -2,13 +2,7 @@ create or replace package body test_extended_coverage is
function get_block_coverage_line return clob is
begin
- return
- case
- when ut3_tester_helper.coverage_helper.block_coverage_available then
- '%'
- else
- '%'
- end;
+ return '%';
end;
procedure coverage_for_object is
l_expected clob;
@@ -130,8 +124,7 @@ create or replace package body test_extended_coverage is
);
--Assert
- --The below is a workaround for problem with large CLOB like comparison on 11g XE db.
- ut.expect(to_char(substr(l_actual,instr(l_actual,''),2000))).to_be_like(l_expected);
+ ut.expect(l_actual).to_be_like(l_expected);
ut.expect(l_actual).not_to_be_like(l_not_expected);
ut.expect(l_actual).not_to_be_like('%ut3_tester_helper.test_regex_dummy_cov%');
end;
diff --git a/test/ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb b/test/ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb
index 2f2200116..883909eb5 100644
--- a/test/ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb
+++ b/test/ut3_user/reporters/test_coverage/test_html_coverage_reporter.pkb
@@ -9,9 +9,7 @@ create or replace package body test_html_coverage_reporter is
begin
--Arrange
l_name := ut3_tester_helper.coverage_helper.covered_package_name;
- if ut3_tester_helper.coverage_helper.block_coverage_available then
- l_block_cov := '(including 1 lines partially covered ) ';
- end if;
+ l_block_cov := '(including 1 lines partially covered ) ';
l_expected := '%%UT3_DEVELOP.'||upper(l_name)||'
' ||
'%2 relevant lines. 1 lines covered ' ||
l_block_cov || 'and 1 lines missed%';
@@ -32,6 +30,26 @@ create or replace package body test_html_coverage_reporter is
ut.expect(l_actual).to_be_like(l_expected);
end;
+ procedure report_support_link is
+ l_actual clob;
+ begin
+ l_actual :=
+ ut3_tester_helper.coverage_helper.run_tests_as_job(
+ q'[
+ ut3_develop.ut.run(
+ a_path => 'ut3_develop.test_dummy_coverage',
+ a_reporter=> ut3_develop.ut_coverage_html_reporter()
+ )
+ ]'
+ );
+
+ ut.expect(l_actual).to_be_like(
+ '%