Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
1f1828f
Updated project version to 3.1.10
jgebal Nov 10, 2019
a33b53d
Updated project version after build [skip ci]
Nov 10, 2019
a2c0a58
Update link for utPLSQL download statistics
jgebal Nov 10, 2019
52794ac
Updated project version after build [skip ci]
Nov 10, 2019
b3973d0
Fixed test dependency on user running them.
jgebal Nov 29, 2019
39d144a
Changed how savepoint name is generated.
jgebal Nov 30, 2019
4bb7a95
Added a hash of owner to the generated savepoint name.
jgebal Nov 30, 2019
f7f9692
Merge pull request #1027 from utPLSQL/feature/minor_test_fixes
jgebal Nov 30, 2019
42053b4
Updated project version after build [skip ci]
Nov 30, 2019
d654ccc
Changed the target location for published documentation.
jgebal Dec 1, 2019
090b74c
Updated project version after build [skip ci]
Dec 1, 2019
e8f4532
Skip as many %endcontext as nested %context annotations
pesse Dec 19, 2019
8df3f7d
Refactoring: Extract function, add variables for readability
pesse Dec 19, 2019
a4d92de
Refactoring: Add clarifying comment
pesse Dec 19, 2019
4d1500f
Refactoring: Move responsibility to get context name completely to ge…
pesse Dec 19, 2019
3c547ec
Fix intendation
pesse Dec 20, 2019
b4c1d72
Refactoring: Use just one return to improve readability
pesse Dec 20, 2019
86185a8
Rewrite get_endcontext_position to be much easier to understand
pesse Dec 20, 2019
89df1dd
Clarify intention of end-position, make it more visible how it's defined
pesse Dec 20, 2019
c61abfa
Get rid of several `in out nocopy` params where `in` would be sufficient
pesse Dec 20, 2019
35acf14
Not necessary to check for IS NOT NULL
pesse Dec 20, 2019
3327fc3
Fix intendation
pesse Dec 20, 2019
587f966
Merge pull request #1035 from utPLSQL/bugfix/nested_context_mixup
jgebal Dec 20, 2019
cef109b
Updated project version after build [skip ci]
Dec 20, 2019
ad0f99d
Fixed repo for publishing github docs.
jgebal Dec 22, 2019
33f5152
Updated project version after build [skip ci]
Dec 22, 2019
8e43a08
Moved validation of `--%throws` annotation values.
jgebal Dec 29, 2019
d33bd80
Updated documentation for whitespace vs null compare.
jgebal Jan 2, 2020
5510555
Fixed documentation.
jgebal Jan 3, 2020
4dea559
Merge pull request #1038 from utPLSQL/bugfix/throws_exceptions_list_p…
jgebal Jan 3, 2020
d02ac94
Changed ordering of tests for suites with context
jgebal Dec 29, 2019
0a4edaf
Test name fix
jgebal Dec 29, 2019
326e055
Added documenting comments for ordering of data from suite_cache.
jgebal Jan 3, 2020
a25b8b7
Updated project version after build [skip ci]
Jan 3, 2020
d708443
Fixed documentation typos.
jgebal Jan 4, 2020
8f38487
Merge pull request #1039 from utPLSQL/feature/update_docs_for_whitesp…
jgebal Jan 4, 2020
d9077a1
Merge pull request #1037 from utPLSQL/feature/test_ordering
jgebal Jan 4, 2020
101bcbf
Updated project version after build [skip ci]
Jan 4, 2020
1b0b8f8
Refactored expectations on compound data
jgebal Feb 15, 2020
8eac19e
Changed maven repo url.
jgebal Feb 15, 2020
d84a684
Removing maven step for obtaining Oracle jdbc drivers - those are now…
jgebal Feb 15, 2020
02ba32b
Removing `/dev/pdbs` directory
jgebal Feb 15, 2020
7363daa
Merge pull request #1044 from utPLSQL/feature/fix_maven_url
jgebal Feb 15, 2020
15d24af
Updated project version after build [skip ci]
Feb 15, 2020
ba90abf
Cleanup and refactoring of annotation cache.
jgebal Aug 5, 2019
335e420
Fixed loophole in privilege check.
jgebal Nov 12, 2019
94f9c43
Merge remote-tracking branch 'origin/develop' into feature/unify_curs…
jgebal Feb 15, 2020
054c39f
Fixed issues with new cursor-results compare query on 11g
jgebal Feb 16, 2020
b39c5be
Added additional tests for annotation cache refresh with/without DDL …
jgebal Feb 17, 2020
5eab4aa
Fixed Teamcity reporting of errors
jgebal Feb 18, 2020
641b3b4
Update install.sh
jgebal Feb 18, 2020
67c4e78
Update test_teamcity_reporter.pkb
jgebal Feb 18, 2020
9c4333e
Merge pull request #1046 from utPLSQL/feature/teamcity_error_reportin…
jgebal Feb 18, 2020
3c0351f
Updated project version after build [skip ci]
Feb 18, 2020
4bed0c4
Merge pull request #1043 from utPLSQL/feature/unify_cursor_compare_be…
jgebal Feb 18, 2020
29b6db4
Updated project version after build [skip ci]
Feb 18, 2020
5d4c33c
Removed unneeded `is_annotated` column
jgebal Feb 22, 2020
62f3154
Merge pull request #986 from utPLSQL/feature/cache_fixes
jgebal Feb 23, 2020
8e54873
Updated project version after build [skip ci]
Feb 23, 2020
a2d1638
Update `releasing.md` file
jgebal Feb 23, 2020
9034250
Updated project version after build [skip ci]
Feb 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved validation of --%throws annotation values.
Now the validation is executed at runtime, when the tests is executed.

This resolves issues related to the fact that some package constants may not exist or be valid at suite parse time.
In such scenario, the annotations continued to be ignored despite the fact that package constants were valid at test runtime.

With this change, tests can now have `--throws` annotations referencing constants that are undefined at compile time.
Resolves #1033
  • Loading branch information
jgebal committed Dec 29, 2019
commit 8e43a089a67e26d951a929b5f285065938b10c3c
114 changes: 109 additions & 5 deletions source/core/types/ut_executable_test.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ create or replace type body ut_executable_test as

member procedure do_execute(
self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
a_expected_error_codes in ut_integer_list
a_expected_error_codes in ut_varchar2_rows
) is
l_completed_without_errors boolean;
begin
Expand All @@ -40,10 +40,114 @@ create or replace type body ut_executable_test as

member function do_execute(
self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
a_expected_error_codes in ut_integer_list
a_expected_error_codes in ut_varchar2_rows
) return boolean is
l_expected_except_message varchar2(4000);
l_expected_error_numbers ut_integer_list;

function build_exception_numbers_list(
a_item in out nocopy ut_suite_item,
a_expected_error_codes in ut_varchar2_rows
) return ut_integer_list is
l_exception_number integer;
l_exception_number_list ut_integer_list := ut_integer_list();
c_regexp_for_exception_no constant varchar2(30) := '^-?[[:digit:]]{1,5}$';

c_integer_exception constant varchar2(1) := 'I';
c_named_exception constant varchar2(1) := 'N';

function is_valid_qualified_name (a_name varchar2) return boolean is
l_name varchar2(500);
begin
l_name := dbms_assert.qualified_sql_name(a_name);
return true;
exception when others then
return false;
end;

function check_exception_type(a_exception_name in varchar2) return varchar2 is
l_exception_type varchar2(50);
begin
--check if it is a predefined exception
begin
execute immediate 'begin null; exception when '||a_exception_name||' then null; end;';
l_exception_type := c_named_exception;
exception
when others then
if dbms_utility.format_error_stack() like '%PLS-00485%' then
declare
e_invalid_number exception;
pragma exception_init ( e_invalid_number, -6502 );
begin
execute immediate 'declare x integer := '||a_exception_name||'; begin null; end;';
l_exception_type := c_integer_exception;
exception
when others then
null;
end;
end if;
end;
return l_exception_type;
end;

function get_exception_number (a_exception_var in varchar2) return integer is
l_exc_no integer;
l_exc_type varchar2(50);
function remap_no_data_found (a_number integer) return integer is
begin
return case a_number when 100 then -1403 else a_number end;
end;
begin
l_exc_type := check_exception_type(a_exception_var);

execute immediate
case l_exc_type
when c_integer_exception then
'declare l_exception number; begin :l_exception := '||a_exception_var||'; end;'
when c_named_exception then
'begin raise '||a_exception_var||'; exception when others then :l_exception := sqlcode; end;'
else
'begin :l_exception := null; end;'
end
using out l_exc_no;

return remap_no_data_found(l_exc_no);
end;

begin
if a_expected_error_codes is not empty then
for i in 1 .. a_expected_error_codes.count loop
/**
* Check if its a valid qualified name and if so try to resolve name to an exception number
*/
if is_valid_qualified_name(a_expected_error_codes(i)) then
l_exception_number := get_exception_number(a_expected_error_codes(i));
elsif regexp_like(a_expected_error_codes(i), c_regexp_for_exception_no) then
l_exception_number := a_expected_error_codes(i);
end if;

if l_exception_number is null then
a_item.put_warning(
'Invalid parameter value "'||a_expected_error_codes(i)||'" for "--%throws" annotation. Parameter ignored.',
self.procedure_name,
a_item.line_no
);
elsif l_exception_number >= 0 then
a_item.put_warning(
'Invalid parameter value "'||a_expected_error_codes(i)||'" for "--%throws" annotation. Exception value must be a negative integer. Parameter ignored.',
self.procedure_name,
a_item.line_no
);
else
l_exception_number_list.extend;
l_exception_number_list(l_exception_number_list.last) := l_exception_number;
end if;
l_exception_number := null;
end loop;
end if;

return l_exception_number_list;
end;
function failed_expec_errnum_message(a_expected_error_codes in ut_integer_list) return varchar is
l_actual_error_no integer;
l_expected_error_codes varchar2(4000);
Expand Down Expand Up @@ -72,9 +176,9 @@ create or replace type body ut_executable_test as
begin
--Create a ut_executable object and call do_execute after that get the data to know the test's execution result
self.do_execute(a_item);

if a_expected_error_codes is not null and a_expected_error_codes is not empty then
l_expected_except_message := failed_expec_errnum_message(a_expected_error_codes);
l_expected_error_numbers := build_exception_numbers_list(a_item, a_expected_error_codes);
if l_expected_error_numbers is not null and l_expected_error_numbers is not empty then
l_expected_except_message := failed_expec_errnum_message( l_expected_error_numbers );

if l_expected_except_message is not null then
ut_expectation_processor.add_expectation_result(
Expand Down
4 changes: 2 additions & 2 deletions source/core/types/ut_executable_test.tps
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ create or replace type ut_executable_test authid current_user under ut_executabl

member procedure do_execute(
self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
a_expected_error_codes in ut_integer_list
a_expected_error_codes in ut_varchar2_rows
),

member function do_execute(
self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
a_expected_error_codes in ut_integer_list
a_expected_error_codes in ut_varchar2_rows
) return boolean

) final;
Expand Down
2 changes: 1 addition & 1 deletion source/core/types/ut_suite_cache_row.tps
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ create type ut_suite_cache_row as object (
before_test_list ut_executables,
after_each_list ut_executables,
after_test_list ut_executables,
expected_error_codes ut_integer_list,
expected_error_codes ut_varchar2_rows,
tags ut_varchar2_rows,
item ut_executable_test
)
Expand Down
10 changes: 10 additions & 0 deletions source/core/types/ut_suite_item.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ create or replace type body ut_suite_item as
self.results_count.increase_warning_count;
end;

member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2, a_procedure_name varchar2, a_line_no integer) is
l_result varchar2(1000);
begin
l_result := self.object_owner || '.' || self.object_name ;
if a_procedure_name is not null then
l_result := l_result || '.' || a_procedure_name ;
end if;
put_warning( a_message || chr( 10 ) || 'at package "' || upper(l_result) || '", line ' || a_line_no );
end;

member function get_transaction_invalidators return ut_varchar2_list is
begin
return transaction_invalidators;
Expand Down
3 changes: 2 additions & 1 deletion source/core/types/ut_suite_item.tps
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ create or replace type ut_suite_item force under ut_event_item (
not instantiable member procedure mark_as_errored(self in out nocopy ut_suite_item, a_error_stack_trace varchar2),
not instantiable member function get_error_stack_traces return ut_varchar2_list,
not instantiable member function get_serveroutputs return clob,
member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2)
member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2),
member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2, a_procedure_name varchar2, a_line_no integer)
)
not final not instantiable
/
2 changes: 1 addition & 1 deletion source/core/types/ut_test.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create or replace type body ut_test as

constructor function ut_test(
self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2,
a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags ut_varchar2_rows := null
a_line_no integer, a_expected_error_codes ut_varchar2_rows := null, a_tags ut_varchar2_rows := null
) return self as result is
begin
self.self_type := $$plsql_unit;
Expand Down
4 changes: 2 additions & 2 deletions source/core/types/ut_test.tps
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ create or replace type ut_test force under ut_suite_item (
/**
*Holds the expected error codes list when the user use the annotation throws
*/
expected_error_codes ut_integer_list,
expected_error_codes ut_varchar2_rows,
constructor function ut_test(
self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2,
a_line_no integer, a_expected_error_codes ut_integer_list := null, a_tags ut_varchar2_rows := null
a_line_no integer, a_expected_error_codes ut_varchar2_rows := null, a_tags ut_varchar2_rows := null
) return self as result,
overriding member procedure mark_as_skipped(self in out nocopy ut_test),
overriding member function do_execute(self in out nocopy ut_test) return boolean,
Expand Down
Loading