Skip to content

Added disabledReason to ut_realtime_reporter #1193

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

Merged
merged 1 commit into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions source/reporters/ut_realtime_reporter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ create or replace type body ut_realtime_reporter is
self.print_node('objectName', a_test.item.object_name);
self.print_node('procedureName', a_test.item.procedure_name);
self.print_node('disabled', case when a_test.get_disabled_flag() then 'true' else 'false' end);
self.print_node('disabledReason', a_test.disabled_reason);
self.print_node('name', a_test.name);
self.print_node('description', a_test.description);
self.print_node('testNumber', to_char(total_number_of_tests));
Expand Down
38 changes: 33 additions & 5 deletions test/ut3_user/reporters/test_realtime_reporter.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ create or replace package body test_realtime_reporter as
--%test
--%disabled
procedure test_5;

--%test
--%disabled(Cannot run this item at this time runtime > 10 mins.)
procedure test_6_disabled_reason;
end;]';
execute immediate q'[create or replace package body check_realtime_reporting2 is
procedure test_3_ok is
Expand All @@ -62,6 +66,11 @@ create or replace package body test_realtime_reporter as
begin
null;
end;

procedure test_6_disabled_reason is
begin
null;
end;
end;]';

execute immediate q'[create or replace package check_realtime_reporting3 is
Expand Down Expand Up @@ -179,6 +188,8 @@ create or replace package body test_realtime_reporter as
select 'post-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_4_nok' as item_id from dual union all
select 'pre-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_5' as item_id from dual union all
select 'post-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_5' as item_id from dual union all
select 'pre-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_6_disabled_reason' as item_id from dual union all
select 'post-test' as event_type, 'realtime_reporting.check_realtime_reporting2.test_6_disabled_reason' as item_id from dual union all
select 'post-suite' as event_type, 'realtime_reporting.check_realtime_reporting2' as item_id from dual union all
select 'pre-suite' as event_type, 'realtime_reporting.check_realtime_reporting1' as item_id from dual union all
select 'pre-suite' as event_type, 'realtime_reporting.check_realtime_reporting1.test_context' as item_id from dual union all
Expand Down Expand Up @@ -226,6 +237,7 @@ create or replace package body test_realtime_reporter as
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
select 'event/items/suite/items/suite/items/test' as node_path from dual union all
select 'event/items/suite/items/suite' as node_path from dual union all
select 'event/items/suite/items/suite/items' as node_path from dual union all
select 'event/items/suite/items/suite/items/suite' as node_path from dual union all
Expand All @@ -237,7 +249,7 @@ create or replace package body test_realtime_reporter as

procedure total_number_of_tests is
l_actual integer;
l_expected integer := 8;
l_expected integer := 9;
begin
select t.event_doc.extract('/event/totalNumberOfTests/text()').getnumberval()
into l_actual
Expand Down Expand Up @@ -283,9 +295,9 @@ create or replace package body test_realtime_reporter as
and t.event_doc.extract('//test/@id').getstringval() is not null;
open l_expected for
select level as test_number,
8 as total_number_of_tests
9 as total_number_of_tests
from dual
connect by level <= 8;
connect by level <= 9;
ut.expect(l_actual).to_equal(l_expected).unordered;
end pre_test_nodes;

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

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

procedure disabled_reason is
l_actual varchar2(32767);
l_expected varchar2(80) := dbms_xmlgen.convert('Cannot run this item at this time runtime > 10 mins.');
begin
select t.event_doc.extract(
'//test/disabledReason/text()'
).getstringval()
into l_actual
from table(g_events) t
where xmlexists(
'/event[@type="pre-run"]/*//test[@id="realtime_reporting.check_realtime_reporting2.test_6_disabled_reason"]'
passing t.event_doc
);
ut.expect(l_actual).to_equal(l_expected);
end;

procedure remove_test_suites is
pragma autonomous_transaction;
begin
Expand Down
3 changes: 3 additions & 0 deletions test/ut3_user/reporters/test_realtime_reporter.pks
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ create or replace package test_realtime_reporter as
--%test(Escape nested CDATA sections in test output)
procedure nested_cdata_output;

--%test(Provide reason disabled test)
procedure disabled_reason;

--%afterall
procedure remove_test_suites;

Expand Down