Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3396fe

Browse files
committed
Update tests for random order
1 parent 2db8d63 commit d3396fe

2 files changed

Lines changed: 5 additions & 37 deletions

File tree

source/core/ut_suite_cache_manager.pkb

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -88,40 +88,6 @@ create or replace package body ut_suite_cache_manager is
8888
return l_result;
8989
end;
9090

91-
function get_random_seed_sql(a_random_seed positive) return varchar2 is
92-
begin
93-
return case
94-
when a_random_seed is null then q'[
95-
nlssort(
96-
replace(
97-
/*suite path until objects name (excluding contexts and test path) with trailing dot (full stop)*/
98-
substr( c.obj.path, 1, instr( c.obj.path, lower(c.obj.object_name), -1 ) + length(c.obj.object_name) ),
99-
'.',
100-
/*'.' replaced with chr(0) to assure that child elements come before parent when sorting in descending order*/
101-
chr(0)
102-
),
103-
'nls_sort=binary'
104-
)desc nulls last,
105-
case when c.obj.self_type = 'UT_SUITE_CONTEXT' then
106-
( select /*+ no_parallel */ max( x.line_no ) + 1
107-
from ut_suite_cache x
108-
where c.obj.object_owner = x.object_owner
109-
and c.obj.object_name = x.object_name
110-
and x.path like c.obj.path || '.%'
111-
)
112-
else
113-
c.obj.line_no
114-
end,
115-
/*assures that child contexts come before parent contexts*/
116-
regexp_count(c.obj.path,'\.') desc,
117-
:a_random_seed]'
118-
else
119-
' ut_runner.hash_suite_path(
120-
c.obj.path, :a_random_seed
121-
) desc nulls last'
122-
end;
123-
end;
124-
12591
function group_paths_by_schema(a_paths ut_varchar2_list) return ut_path_items is
12692
c_package_path_regex constant varchar2(100) := '^([A-Za-z0-9$#_]+)(\.([A-Za-z0-9$#_\*]+))?(\.([A-Za-z0-9$#_\*]+))?$';
12793
l_results ut_path_items := ut_path_items();
@@ -302,7 +268,9 @@ create or replace package body ut_suite_cache_manager is
302268
begin
303269
with
304270
extract_parent_child as (
305-
select s.path, substr(s.path,1,instr(s.path,'.',-1,1)-1) as parent_path,s.object_owner,s.line_no,a_random_seed random_seed
271+
select s.path, substr(s.path,1,instr(s.path,'.',-1,1)-1) as parent_path,s.object_owner,
272+
case when a_random_seed is null then s.line_no else null end line_no,
273+
case when a_random_seed is null then null else ut_runner.hash_suite_path(s.path, a_random_seed) end random_seed
306274
from table(a_suite_rows) s),
307275
t1(path,parent_path,object_owner,line_no,random_seed) as (
308276
--Anchor memeber
@@ -315,7 +283,7 @@ create or replace package body ut_suite_cache_manager is
315283
from t1,extract_parent_child t2
316284
where t2.parent_path = t1.path
317285
and t1.object_owner = t2.object_owner)
318-
search depth first by line_no desc,random_seed set order1
286+
search depth first by line_no desc,random_seed desc nulls last set order1
319287
select value(i) as obj
320288
bulk collect into l_suite_rows
321289
from t1 c

test/ut3_user/api/test_ut_run.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ Failures:%
854854
l_results ut3_develop.ut_varchar2_list;
855855
begin
856856
select * bulk collect into l_random_results
857-
from table ( ut3_develop.ut.run( 'ut3_tester_helper.test_package_1', a_random_test_order_seed => 3 ) )
857+
from table ( ut3_develop.ut.run( 'ut3_tester_helper.test_package_1', a_random_test_order_seed => 6 ) )
858858
where trim(column_value) is not null and column_value not like 'Finished in %'
859859
and column_value not like '%Tests were executed with random order %';
860860

0 commit comments

Comments
 (0)