Update TFS reporter to correct format by lwasylow · Pull Request #1270 · utPLSQL/utPLSQL · GitHub
Skip to content
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
98 changes: 61 additions & 37 deletions source/reporters/ut_tfs_junit_reporter.tpb
161 changes: 153 additions & 8 deletions test/ut3_user/reporters/test_tfs_junit_reporter.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ create or replace package body test_tfs_junit_reporter as

--%test(A test with <tag>)
procedure test_do_stuff;

end;]';
execute immediate q'[create or replace package body check_junit_reporting is
procedure test_do_stuff is
Expand All @@ -18,12 +18,12 @@ create or replace package body test_tfs_junit_reporter as
end;

end;]';

execute immediate q'[create or replace package check_junit_rep_suitepath is
--%suitepath(core)
--%suite(check_junit_rep_suitepath)
--%displayname(Check JUNIT Get path for suitepath)

--%test(check_junit_rep_suitepath)
--%displayname(Check JUNIT Get path for suitepath)
procedure check_junit_rep_suitepath;
Expand All @@ -38,7 +38,7 @@ create or replace package body test_tfs_junit_reporter as
execute immediate q'[create or replace package check_junit_flat_suitepath is
--%suitepath(core.check_junit_rep_suitepath)
--%suite(flatsuitepath)

--%beforeall
procedure donuffin;
end;]';
Expand All @@ -49,8 +49,85 @@ create or replace package body test_tfs_junit_reporter as
end;
end;]';

end;
execute immediate q'[create or replace package check_junit_in_context is
--%suitepath(core.check_junit_rep_suitepath)
--%suite(inctxsuite)
--%displayname(JUNIT test are inside context)

-- %context(incontext)
-- %name(incontext)

--%test(incontext)
--%displayname(Check JUNIT Get path incontext)
procedure check_junit_rep_incontext;

-- %endcontext
end;]';
execute immediate q'[create or replace package body check_junit_in_context is
procedure check_junit_rep_incontext is
begin
ut3_develop.ut.expect(1).to_equal(1);
end;
end;]';

execute immediate q'[create or replace package check_junit_out_context is
--%suitepath(core)
--%suite(outctxsuite)
--%displayname(JUNIT test are outside context)

-- %context(outcontext)
-- %name(outcontext)

-- %endcontext


--%test(outctx)
--%displayname(outctx)
procedure outctx;


end;]';
execute immediate q'[create or replace package body check_junit_out_context is
procedure outctx is
begin
ut3_develop.ut.expect(1).to_equal(1);
end;
end;]';

execute immediate q'[create or replace package check_junit_inout_context is
--%suitepath(core)
--%suite(inoutcontext)
--%displayname(Test in and out of context)

-- %context(incontext)
-- %name(ProductincontextFeatures)

--%test(inctx)
--%displayname(inctx)
procedure inctx;

-- %endcontext


--%test(outctx)
--%displayname(outctx)
procedure outctx;


end;]';
execute immediate q'[create or replace package body check_junit_inout_context is
procedure inctx is
begin
ut3_develop.ut.expect(1).to_equal(1);
end;

procedure outctx is
begin
ut3_develop.ut.expect(1).to_equal(1);
end;
end;]';

end;

procedure escapes_special_chars is
l_results ut3_develop.ut_varchar2_list;
Expand Down Expand Up @@ -92,7 +169,7 @@ create or replace package body test_tfs_junit_reporter as
--Assert
ut.expect(l_actual).to_be_like('%testcase classname="check_junit_reporting"%');
end;

procedure check_flatten_nested_suites is
l_results ut3_develop.ut_varchar2_list;
l_actual clob;
Expand All @@ -111,7 +188,7 @@ create or replace package body test_tfs_junit_reporter as
<system-err/>
</testsuite>%');
end;

procedure check_nls_number_formatting is
l_results ut3_develop.ut_varchar2_list;
l_actual clob;
Expand Down Expand Up @@ -163,5 +240,73 @@ create or replace package body test_tfs_junit_reporter as
reporters.check_xml_encoding_included(ut3_develop.ut_tfs_junit_reporter(), 'UTF-8');
end;

procedure reports_only_test_in_ctx is
l_results ut3_develop.ut_varchar2_list;
l_actual clob;
begin
--Act
select *
bulk collect into l_results
from table(ut3_develop.ut.run('check_junit_in_context',ut3_develop.ut_tfs_junit_reporter()));
l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
--Assert
ut.expect(l_actual).to_be_like('<?xml version="1.0"?>
<testsuites>
<testsuite tests="1" id="1" package="core.check_junit_rep_suitepath.check_junit_in_context" errors="0" failures="0" name="JUNIT test are inside context" time="%" timestamp="%" hostname="%" >
<properties/>
<testcase classname="core.check_junit_rep_suitepath.check_junit_in_context.incontext" name="Check JUNIT Get path incontext" time="%">
</testcase>
<system-out/>
<system-err/>
</testsuite>
</testsuites>%');
end;

procedure reports_only_test_out_ctx is
l_results ut3_develop.ut_varchar2_list;
l_actual clob;
begin
--Act
select *
bulk collect into l_results
from table(ut3_develop.ut.run('check_junit_out_context',ut3_develop.ut_tfs_junit_reporter()));
l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
--Assert
ut.expect(l_actual).to_be_like('<?xml version="1.0"?>
<testsuites>
<testsuite tests="1" id="1" package="core.check_junit_out_context" errors="0" failures="0" name="JUNIT test are outside context" time="%" timestamp="%" hostname="%" >
<properties/>
<testcase classname="core.check_junit_out_context" name="outctx" time="%">
</testcase>
<system-out/>
<system-err/>
</testsuite>
</testsuites>%');
end;

procedure reports_only_test_inout_ctx is
l_results ut3_develop.ut_varchar2_list;
l_actual clob;
begin
--Act
select *
bulk collect into l_results
from table(ut3_develop.ut.run('check_junit_inout_context',ut3_develop.ut_tfs_junit_reporter()));
l_actual := ut3_tester_helper.main_helper.table_to_clob(l_results);
--Assert
ut.expect(l_actual).to_be_like('<?xml version="1.0"?>
<testsuites>
<testsuite tests="2" id="1" package="core.check_junit_inout_context" errors="0" failures="0" name="Test in and out of context" time="%" timestamp="%" hostname="%" >
<properties/>
<testcase classname="core.check_junit_inout_context.ProductincontextFeatures" name="inctx" time="%">
</testcase>
<testcase classname="core.check_junit_inout_context" name="outctx" time="%">
</testcase>
<system-out/>
<system-err/>
</testsuite>
</testsuites>%');
end;

end;
/
/
9 changes: 9 additions & 0 deletions test/ut3_user/reporters/test_tfs_junit_reporter.pks