-
Notifications
You must be signed in to change notification settings - Fork 189
Add a_fail_on_error parameter to ut.run to support raising exceptions on test failures #1308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ create or replace package body ut is | |
| */ | ||
|
|
||
| g_nls_date_format varchar2(4000); | ||
| gc_fail_on_errors constant boolean := false; | ||
|
|
||
| g_result_line_no binary_integer; | ||
| g_result_lines ut_varchar2_list := ut_varchar2_list(); | ||
|
|
@@ -135,7 +134,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| pragma autonomous_transaction; | ||
| begin | ||
|
|
@@ -149,7 +149,7 @@ create or replace package body ut is | |
| a_test_file_mappings, | ||
| a_include_objects, | ||
| a_exclude_objects, | ||
| gc_fail_on_errors, | ||
| a_fail_on_errors, | ||
| a_client_character_set, | ||
| false, | ||
| ut_utils.int_to_boolean(a_random_test_order), | ||
|
|
@@ -179,7 +179,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| pragma autonomous_transaction; | ||
| begin | ||
|
|
@@ -194,7 +195,7 @@ create or replace package body ut is | |
| ut_file_mapper.build_file_mappings(a_test_files), | ||
| a_include_objects, | ||
| a_exclude_objects, | ||
| gc_fail_on_errors, | ||
| a_fail_on_errors, | ||
| a_client_character_set, | ||
| false, | ||
| ut_utils.int_to_boolean(a_random_test_order), | ||
|
|
@@ -253,7 +254,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) return ut_varchar2_rows pipelined is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| l_results sys_refcursor; | ||
|
|
@@ -274,7 +276,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr, | ||
| a_fail_on_errors | ||
| ); | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
| l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); | ||
|
|
@@ -301,7 +304,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) return ut_varchar2_rows pipelined is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| l_results sys_refcursor; | ||
|
|
@@ -322,7 +326,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
| l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); | ||
|
|
@@ -350,7 +355,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) return ut_varchar2_rows pipelined is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| l_results sys_refcursor; | ||
|
|
@@ -371,7 +377,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
| l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); | ||
|
|
@@ -399,7 +406,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) return ut_varchar2_rows pipelined is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| l_results sys_refcursor; | ||
|
|
@@ -420,7 +428,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
| l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); | ||
|
|
@@ -448,7 +457,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) return ut_varchar2_rows pipelined is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| l_results sys_refcursor; | ||
|
|
@@ -469,7 +479,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
| l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); | ||
|
|
@@ -497,7 +508,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) return ut_varchar2_rows pipelined is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| l_results sys_refcursor; | ||
|
|
@@ -518,7 +530,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
| l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor(); | ||
|
|
@@ -547,12 +560,14 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| begin | ||
| l_reporter := coalesce(l_reporter,ut_documentation_reporter()); | ||
| if a_force_manual_rollback then | ||
| l_reporter := coalesce(l_reporter,ut_documentation_reporter()); | ||
|
|
||
| ut_runner.run( | ||
| a_paths, | ||
| ut_reporters(l_reporter), | ||
|
|
@@ -562,7 +577,7 @@ create or replace package body ut is | |
| a_test_file_mappings, | ||
| a_include_objects, | ||
| a_exclude_objects, | ||
| gc_fail_on_errors, | ||
| a_fail_on_errors, | ||
| a_client_character_set, | ||
| a_force_manual_rollback, | ||
| a_random_test_order, | ||
|
|
@@ -590,13 +605,21 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| end if; | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
| treat(l_reporter as ut_output_reporter_base).lines_to_dbms_output(); | ||
| end if; | ||
| raise_if_packages_invalidated(); | ||
|
|
||
| exception when others then | ||
| if l_reporter is of (ut_output_reporter_base) then | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any specific reason to add this exception handler?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| treat(l_reporter as ut_output_reporter_base).lines_to_dbms_output(); | ||
| end if; | ||
| raise_if_packages_invalidated(); | ||
| raise; | ||
| end; | ||
|
|
||
| procedure run( | ||
|
|
@@ -616,7 +639,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| l_reporter ut_reporter_base := a_reporter; | ||
| begin | ||
|
|
@@ -637,7 +661,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| end; | ||
|
|
||
|
|
@@ -657,7 +682,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| begin | ||
| ut.run( | ||
|
|
@@ -677,7 +703,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| end; | ||
|
|
||
|
|
@@ -697,7 +724,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| begin | ||
| ut.run( | ||
|
|
@@ -717,7 +745,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| end; | ||
|
|
||
|
|
@@ -738,7 +767,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| begin | ||
| ut.run( | ||
|
|
@@ -758,7 +788,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr , | ||
| a_fail_on_errors | ||
| ); | ||
| end; | ||
|
|
||
|
|
@@ -779,7 +810,8 @@ create or replace package body ut is | |
| a_include_schema_expr varchar2 := null, | ||
| a_include_object_expr varchar2 := null, | ||
| a_exclude_schema_expr varchar2 := null, | ||
| a_exclude_object_expr varchar2 := null | ||
| a_exclude_object_expr varchar2 := null, | ||
| a_fail_on_errors boolean := false | ||
| ) is | ||
| begin | ||
| ut.run( | ||
|
|
@@ -799,7 +831,8 @@ create or replace package body ut is | |
| a_include_schema_expr, | ||
| a_include_object_expr, | ||
| a_exclude_schema_expr, | ||
| a_exclude_object_expr | ||
| a_exclude_object_expr, | ||
| a_fail_on_errors | ||
| ); | ||
| end; | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit tests are required to confirm that the functionality is working.
Please add at least 1 tests to the
test_ut_runpackage.To confirm that when a failing UT is executed - an exception is thrown.
You could also add a negative test, to confirm that with null/false parameter value - no exception is thrown.