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

Skip to content

Commit 7e680ee

Browse files
committed
Added disabledReason to ut_realtime_reporter
1 parent fd81df2 commit 7e680ee

3 files changed

Lines changed: 37 additions & 5 deletions

File tree

source/reporters/ut_realtime_reporter.tpb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ create or replace type body ut_realtime_reporter is
4343
self.print_node('objectName', a_test.item.object_name);
4444
self.print_node('procedureName', a_test.item.procedure_name);
4545
self.print_node('disabled', case when a_test.get_disabled_flag() then 'true' else 'false' end);
46+
self.print_node('disabledReason', a_test.disabled_reason);
4647
self.print_node('name', a_test.name);
4748
self.print_node('description', a_test.description);
4849
self.print_node('testNumber', to_char(total_number_of_tests));

test/ut3_user/reporters/test_realtime_reporter.pkb

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ create or replace package body test_realtime_reporter as
4545
--%test
4646
--%disabled
4747
procedure test_5;
48+
49+
--%test
50+
--%disabled(Cannot run this item at this time runtime > 10 mins.)
51+
procedure test_6_disabled_reason;
4852
end;]';
4953
execute immediate q'[create or replace package body check_realtime_reporting2 is
5054
procedure test_3_ok is
@@ -62,6 +66,11 @@ create or replace package body test_realtime_reporter as
6266
begin
6367
null;
6468
end;
69+
70+
procedure test_6_disabled_reason is
71+
begin
72+
null;
73+
end;
6574
end;]';
6675

6776
execute immediate q'[create or replace package check_realtime_reporting3 is
@@ -179,6 +188,8 @@ create or replace package body test_realtime_reporter as
179188
select 'post-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_4_nok' as item_id from dual union all
180189
select 'pre-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_5' as item_id from dual union all
181190
select 'post-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_5' as item_id from dual union all
191+
select 'pre-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_6_disabled_reason' as item_id from dual union all
192+
select 'post-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_6_disabled_reason' as item_id from dual union all
182193
select 'post-suite' as event_type, 'realtime_reporting.check_realtime_reporting2' as item_id from dual union all
183194
select 'pre-suite' as event_type, 'realtime_reporting.check_realtime_reporting1' as item_id from dual union all
184195
select 'pre-suite' as event_type, 'realtime_reporting.check_realtime_reporting1.test_context' as item_id from dual union all
@@ -226,6 +237,7 @@ create or replace package body test_realtime_reporter as
226237
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
227238
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
228239
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
240+
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
229241
select 'event/items/suite/items/suite' as node_path from dual union all
230242
select 'event/items/suite/items/suite/items' as node_path from dual union all
231243
select 'event/items/suite/items/suite/items/suite' as node_path from dual union all
@@ -237,7 +249,7 @@ create or replace package body test_realtime_reporter as
237249

238250
procedure total_number_of_tests is
239251
l_actual integer;
240-
l_expected integer := 8;
252+
l_expected integer := 9;
241253
begin
242254
select t.event_doc.extract('/event/totalNumberOfTests/text()').getnumberval()
243255
into l_actual
@@ -283,9 +295,9 @@ create or replace package body test_realtime_reporter as
283295
and t.event_doc.extract('//test/@id').getstringval() is not null;
284296
open l_expected for
285297
select level as test_number,
286-
8 as total_number_of_tests
298+
9 as total_number_of_tests
287299
from dual
288-
connect by level <= 8;
300+
connect by level <= 9;
289301
ut.expect(l_actual).to_equal(l_expected).unordered;
290302
end pre_test_nodes;
291303

@@ -311,9 +323,9 @@ create or replace package body test_realtime_reporter as
311323
and t.event_doc.extract('//test/counter/warning/text()').getnumberval() is not null;
312324
open l_expected for
313325
select level as test_number,
314-
8 as total_number_of_tests
326+
9 as total_number_of_tests
315327
from dual
316-
connect by level <= 8;
328+
connect by level <= 9;
317329
ut.expect(l_actual).to_equal(l_expected).unordered;
318330
end post_test_nodes;
319331

@@ -494,6 +506,22 @@ create or replace package body test_realtime_reporter as
494506
ut.expect(l_xml is not null).to_be_true();
495507
end;
496508

509+
procedure disabled_reason is
510+
l_actual varchar2(32767);
511+
l_expected varchar2(80) := dbms_xmlgen.convert('Cannot run this item at this time runtime > 10 mins.');
512+
begin
513+
select t.event_doc.extract(
514+
'//test/disabledReason/text()'
515+
).getstringval()
516+
into l_actual
517+
from table(g_events) t
518+
where xmlexists(
519+
'/event[@type="pre-run"]/*//test[@id="realtime_reporting.check_realtime_reporting2.test_6_disabled_reason"]'
520+
passing t.event_doc
521+
);
522+
ut.expect(l_actual).to_equal(l_expected);
523+
end;
524+
497525
procedure remove_test_suites is
498526
pragma autonomous_transaction;
499527
begin

test/ut3_user/reporters/test_realtime_reporter.pks

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ create or replace package test_realtime_reporter as
5757
--%test(Escape nested CDATA sections in test output)
5858
procedure nested_cdata_output;
5959

60+
--%test(Provide reason disabled test)
61+
procedure disabled_reason;
62+
6063
--%afterall
6164
procedure remove_test_suites;
6265

0 commit comments

Comments
 (0)