Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added support for random order of test execution.
Resolves #422
  • Loading branch information
jgebal committed Mar 26, 2019
commit 23da3d7e1e08a89915947dff20cc55ca0ad05bf1
5 changes: 3 additions & 2 deletions development/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ git rev-parse && cd "$(git rev-parse --show-cdup)"

"${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL
set echo on
set serveroutput on
begin
for x in (
select * from dba_objects
Expand All @@ -25,12 +26,12 @@ drop user ${UT3_USER} cascade;

begin
for i in (
select decode(owner,'PUBLIC','drop public synonym "','drop synonym "'||owner||'"."')|| synonym_name ||'"' drop_orphaned_synonym from dba_synonyms a
select decode(owner,'PUBLIC','drop public synonym "','drop synonym "'||owner||'"."')|| synonym_name ||'"' drop_orphaned_synonym, owner||'.'||synonym_name syn from dba_synonyms a
where not exists (select 1 from dba_objects b where (a.table_name=b.object_name and a.table_owner=b.owner or b.owner='SYS' and a.table_owner=b.object_name) )
and a.table_owner not in ('SYS','SYSTEM')
) loop
dbms_output.put_line(i.drop_orphaned_synonym);
execute immediate i.drop_orphaned_synonym;
dbms_output.put_line('synonym '||i.syn||' dropped');
end loop;
end;
/
Expand Down
122 changes: 91 additions & 31 deletions source/api/ut.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ create or replace package body ut is
a_paths ut_varchar2_list,
a_reporter in out nocopy ut_reporter_base,
a_color_console integer,
a_coverage_schemes ut_varchar2_list := null,
a_coverage_schemes ut_varchar2_list,
a_source_file_mappings ut_file_mappings,
a_test_file_mappings ut_file_mappings,
a_include_objects ut_varchar2_list,
a_exclude_objects ut_varchar2_list,
a_client_character_set varchar2 := null
a_client_character_set varchar2,
a_random_test_order integer,
a_random_test_order_seed positive
) is
pragma autonomous_transaction;
begin
Expand All @@ -133,7 +135,10 @@ create or replace package body ut is
a_include_objects,
a_exclude_objects,
gc_fail_on_errors,
a_client_character_set
a_client_character_set,
false,
ut_utils.int_to_boolean(a_random_test_order),
a_random_test_order_seed
);
rollback;
end;
Expand All @@ -142,12 +147,14 @@ create or replace package body ut is
a_paths ut_varchar2_list,
a_reporter in out nocopy ut_reporter_base,
a_color_console integer,
a_coverage_schemes ut_varchar2_list := null,
a_coverage_schemes ut_varchar2_list,
a_source_files ut_varchar2_list,
a_test_files ut_varchar2_list,
a_include_objects ut_varchar2_list,
a_exclude_objects ut_varchar2_list,
a_client_character_set varchar2 := null
a_client_character_set varchar2,
a_random_test_order integer,
a_random_test_order_seed positive
) is
pragma autonomous_transaction;
begin
Expand All @@ -162,7 +169,10 @@ create or replace package body ut is
a_include_objects,
a_exclude_objects,
gc_fail_on_errors,
a_client_character_set
a_client_character_set,
false,
ut_utils.int_to_boolean(a_random_test_order),
a_random_test_order_seed
);
rollback;
end;
Expand Down Expand Up @@ -200,7 +210,9 @@ create or replace package body ut is
a_test_file_mappings ut_file_mappings := null,
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null
a_client_character_set varchar2 := null,
a_random_test_order integer := 0,
a_random_test_order_seed positive := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_results sys_refcursor;
Expand All @@ -214,7 +226,9 @@ create or replace package body ut is
a_test_file_mappings,
a_include_objects,
a_exclude_objects,
a_client_character_set
a_client_character_set,
a_random_test_order,
a_random_test_order_seed
);
if l_reporter is of (ut_output_reporter_base) then
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
Expand All @@ -233,7 +247,9 @@ create or replace package body ut is
a_test_files ut_varchar2_list,
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null
a_client_character_set varchar2 := null,
a_random_test_order integer := 0,
a_random_test_order_seed positive := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_results sys_refcursor;
Expand All @@ -247,7 +263,9 @@ create or replace package body ut is
a_test_files,
a_include_objects,
a_exclude_objects,
a_client_character_set
a_client_character_set,
a_random_test_order,
a_random_test_order_seed
);
if l_reporter is of (ut_output_reporter_base) then
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
Expand All @@ -267,7 +285,9 @@ create or replace package body ut is
a_test_file_mappings ut_file_mappings := null,
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null
a_client_character_set varchar2 := null,
a_random_test_order integer := 0,
a_random_test_order_seed positive := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_results sys_refcursor;
Expand All @@ -281,7 +301,9 @@ create or replace package body ut is
a_test_file_mappings,
a_include_objects,
a_exclude_objects,
a_client_character_set
a_client_character_set,
a_random_test_order,
a_random_test_order_seed
);
if l_reporter is of (ut_output_reporter_base) then
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
Expand All @@ -301,7 +323,9 @@ create or replace package body ut is
a_test_files ut_varchar2_list,
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null
a_client_character_set varchar2 := null,
a_random_test_order integer := 0,
a_random_test_order_seed positive := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_results sys_refcursor;
Expand All @@ -315,7 +339,9 @@ create or replace package body ut is
a_test_files,
a_include_objects,
a_exclude_objects,
a_client_character_set
a_client_character_set,
a_random_test_order,
a_random_test_order_seed
);
if l_reporter is of (ut_output_reporter_base) then
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
Expand All @@ -335,7 +361,9 @@ create or replace package body ut is
a_test_file_mappings ut_file_mappings := null,
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null
a_client_character_set varchar2 := null,
a_random_test_order integer := 0,
a_random_test_order_seed positive := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_results sys_refcursor;
Expand All @@ -349,7 +377,9 @@ create or replace package body ut is
a_test_file_mappings,
a_include_objects,
a_exclude_objects,
a_client_character_set
a_client_character_set,
a_random_test_order,
a_random_test_order_seed
);
if l_reporter is of (ut_output_reporter_base) then
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
Expand All @@ -369,7 +399,9 @@ create or replace package body ut is
a_test_files ut_varchar2_list,
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null
a_client_character_set varchar2 := null,
a_random_test_order integer := 0,
a_random_test_order_seed positive := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_results sys_refcursor;
Expand All @@ -383,7 +415,9 @@ create or replace package body ut is
a_test_files,
a_include_objects,
a_exclude_objects,
a_client_character_set
a_client_character_set,
a_random_test_order,
a_random_test_order_seed
);
if l_reporter is of (ut_output_reporter_base) then
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
Expand All @@ -404,7 +438,9 @@ create or replace package body ut is
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null,
a_force_manual_rollback boolean := false
a_force_manual_rollback boolean := false,
a_random_test_order boolean := false,
a_random_test_order_seed positive := null
) is
l_reporter ut_reporter_base := a_reporter;
begin
Expand All @@ -421,7 +457,9 @@ create or replace package body ut is
a_exclude_objects,
gc_fail_on_errors,
a_client_character_set,
a_force_manual_rollback
a_force_manual_rollback,
a_random_test_order,
a_random_test_order_seed
);
else
run_autonomous(
Expand All @@ -433,7 +471,9 @@ create or replace package body ut is
a_test_file_mappings,
a_include_objects,
a_exclude_objects,
a_client_character_set
a_client_character_set,
ut_utils.boolean_to_int(a_random_test_order),
a_random_test_order_seed
);
end if;
if l_reporter is of (ut_output_reporter_base) then
Expand All @@ -452,7 +492,9 @@ create or replace package body ut is
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null,
a_force_manual_rollback boolean := false
a_force_manual_rollback boolean := false,
a_random_test_order boolean := false,
a_random_test_order_seed positive := null
) is
l_reporter ut_reporter_base := a_reporter;
begin
Expand All @@ -466,7 +508,9 @@ create or replace package body ut is
a_include_objects,
a_exclude_objects,
a_client_character_set,
a_force_manual_rollback
a_force_manual_rollback,
a_random_test_order,
a_random_test_order_seed
);
end;

Expand All @@ -479,7 +523,9 @@ create or replace package body ut is
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null,
a_force_manual_rollback boolean := false
a_force_manual_rollback boolean := false,
a_random_test_order boolean := false,
a_random_test_order_seed positive := null
) is
begin
ut.run(
Expand All @@ -492,7 +538,9 @@ create or replace package body ut is
a_include_objects,
a_exclude_objects,
a_client_character_set,
a_force_manual_rollback
a_force_manual_rollback,
a_random_test_order,
a_random_test_order_seed
);
end;

Expand All @@ -505,7 +553,9 @@ create or replace package body ut is
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null,
a_force_manual_rollback boolean := false
a_force_manual_rollback boolean := false,
a_random_test_order boolean := false,
a_random_test_order_seed positive := null
) is
begin
ut.run(
Expand All @@ -518,7 +568,9 @@ create or replace package body ut is
a_include_objects,
a_exclude_objects,
a_client_character_set,
a_force_manual_rollback
a_force_manual_rollback,
a_random_test_order,
a_random_test_order_seed
);
end;

Expand All @@ -532,7 +584,9 @@ create or replace package body ut is
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null,
a_force_manual_rollback boolean := false
a_force_manual_rollback boolean := false,
a_random_test_order boolean := false,
a_random_test_order_seed positive := null
) is
begin
ut.run(
Expand All @@ -545,7 +599,9 @@ create or replace package body ut is
a_include_objects,
a_exclude_objects,
a_client_character_set,
a_force_manual_rollback
a_force_manual_rollback,
a_random_test_order,
a_random_test_order_seed
);
end;

Expand All @@ -559,7 +615,9 @@ create or replace package body ut is
a_include_objects ut_varchar2_list := null,
a_exclude_objects ut_varchar2_list := null,
a_client_character_set varchar2 := null,
a_force_manual_rollback boolean := false
a_force_manual_rollback boolean := false,
a_random_test_order boolean := false,
a_random_test_order_seed positive := null
) is
begin
ut.run(
Expand All @@ -572,7 +630,9 @@ create or replace package body ut is
a_include_objects,
a_exclude_objects,
a_client_character_set,
a_force_manual_rollback
a_force_manual_rollback,
a_random_test_order,
a_random_test_order_seed
);
end;

Expand Down
Loading