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
Prev Previous commit
Next Next commit
Removed obsolete old tests.
Updated tests.
Added test for `sonar_test_reporter`
  • Loading branch information
jgebal committed Jun 10, 2018
commit 7943b57ca4dd9cadbfeea30475d6ca3a69c2d651
10 changes: 3 additions & 7 deletions old_tests/RunAll.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,12 @@ exec ut_coverage.set_develop_mode(true);
@@lib/RunTest.sql ut_output_buffer/send_line.DoesNotSendLineIfNullTextGiven.sql
@@lib/RunTest.sql ut_output_buffer/send_line.SendsALineIntoBufferTable.sql

@@lib/RunTest.sql ut_reporters/ut_coverage_sonar_reporter.AcceptsFileMapping.sql
@@lib/RunTest.sql ut_reporters/ut_coverage_sonar_reporter.BuildsSonarCoverageReport.sql
@@lib/RunTest.sql ut_reporters/ut_documentation_reporter.providesCorrectLineFromStacktrace.sql
@@lib/RunTest.sql ut_reporters/ut_sonar_test_reporter.AcceptsFileMapping.sql
@@lib/RunTest.sql ut_reporters/ut_sonar_test_reporter.ProducesExpectedOutputs.sql
@@lib/RunTest.sql ut_reporters/ut_teamcity_reporter.ProducesExpectedOutputs.sql
@@lib/RunTest.sql ut_reporters/ut_html_reporter.UserOverrideSchemaCoverage.sql
@@lib/RunTest.sql ut_reporters/ut_html_reporter.DefaultSchemaCoverage.sql
@@lib/RunTest.sql ut_reporters/ut_documentation_reporter.reportMultipleWarnings.sql
@@lib/RunTest.sql ut_reporters/ut_documentation_reporter.reportTestTiming.sql
@@lib/RunTest.sql ut_reporters/ut_html_reporter.DefaultSchemaCoverage.sql
@@lib/RunTest.sql ut_reporters/ut_html_reporter.UserOverrideSchemaCoverage.sql
@@lib/RunTest.sql ut_reporters/ut_teamcity_reporter.ProducesExpectedOutputs.sql

@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileList.sql
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileListWithSutePaths.sql
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 3 additions & 2 deletions test/core/reporters.pkb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
create or replace package body reporters is

procedure create_test_helper_package is
pragma autonomous_transaction;
begin
execute immediate q'[create or replace package test_reporters
as
Expand Down Expand Up @@ -119,12 +120,12 @@ end;]';
end;

procedure reporters_cleanup is
pragma autonomous_transaction;
begin
drop_test_helper_package;
end;

procedure check_xml_encoding_included(
a_suite varchar2,
a_reporter ut3.ut_output_reporter_base,
a_client_character_set varchar2
) is
Expand All @@ -134,7 +135,7 @@ end;]';
--Act
select *
bulk collect into l_results
from table(ut3.ut.run(a_suite, a_reporter, a_client_character_set => a_client_character_set));
from table(ut3.ut.run('test_reporters', a_reporter, a_client_character_set => a_client_character_set));
l_actual := ut3.ut_utils.table_to_clob(l_results);
--Assert
ut.expect(l_actual).to_be_like('<?xml version="1.0" encoding="'||lower(a_client_character_set)||'"?>%');
Expand Down
6 changes: 5 additions & 1 deletion test/core/reporters.pks
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
create or replace package reporters is

--%suite
--%suitepath(utplsql.core)

--%beforeall
procedure reporters_setup;

--%afterall
procedure reporters_cleanup;

procedure check_xml_encoding_included(
a_suite varchar2,
a_reporter ut3.ut_output_reporter_base,
a_client_character_set varchar2
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ create or replace package body test_coverage_sonar_reporter is

procedure check_encoding_included is
begin
reporters.check_xml_encoding_included('ut3.test_dummy_coverage', ut3.ut_coverage_sonar_reporter(), 'UTF-8');
reporters.check_xml_encoding_included(ut3.ut_coverage_sonar_reporter(), 'UTF-8');
end;

end;
Expand Down
6 changes: 2 additions & 4 deletions test/core/reporters/test_junit_reporter.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ create or replace package body test_junit_reporter as
end;
end;]';

reporters.reporters_setup;

end;

procedure escapes_special_chars is
Expand Down Expand Up @@ -335,7 +333,7 @@ create or replace package body test_junit_reporter as

procedure check_encoding_included is
begin
reporters.check_xml_encoding_included('check_fail_escape', ut3.ut_junit_reporter(), 'UTF-8');
reporters.check_xml_encoding_included(ut3.ut_junit_reporter(), 'UTF-8');
end;

procedure remove_test_package is
Expand All @@ -347,7 +345,7 @@ create or replace package body test_junit_reporter as
execute immediate 'drop package tst_package_junit_nosuite';
execute immediate 'drop package check_fail_escape';
execute immediate 'drop package Tst_Fix_Case_Sensitive';
reporters.reporters_cleanup;
end;

end;
/
36 changes: 36 additions & 0 deletions test/core/reporters/test_sonar_test_reporter.pkb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
create or replace package body test_sonar_test_reporter as

procedure report_produces_expected_out is
l_results ut3.ut_varchar2_list;
l_actual clob;
l_expected varchar2(32767):=q'[<?xml version="1.0"?>
<testExecutions version="1">
<file path="tests/helpers/test_reporters.pkb">
<testCase name="passing_test" duration="%" >%</testCase>
<testCase name="failing_test" duration="%" >%<failure message="some expectations have failed">%</failure>%</testCase>
<testCase name="erroring_test" duration="%" >%<error message="encountered errors">%</error>%</testCase>
<testCase name="disabled_test" duration="0" >%<skipped message="skipped"/>%</testCase>
</file>
</testExecutions>]';

begin
select *
bulk collect into l_results
from table(
ut3.ut.run(
'test_reporters',
ut3.ut_sonar_test_reporter(),
a_test_file_mappings => ut3.ut_file_mapper.build_file_mappings( user, ut3.ut_varchar2_list('tests/helpers/test_reporters.pkb'))
)
);
l_actual := ut3.ut_utils.table_to_clob(l_results);
ut.expect(l_actual).to_be_like(l_expected);
end;

procedure check_encoding_included is
begin
reporters.check_xml_encoding_included(ut3.ut_sonar_test_reporter(), 'UTF-8');
end;

end;
/
13 changes: 13 additions & 0 deletions test/core/reporters/test_sonar_test_reporter.pks
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
create or replace package test_sonar_test_reporter as

--%suite(ut_sonar_test_reporter)
--%suitepath(utplsql.core.reporters)

--%test(Report produces expected output)
procedure report_produces_expected_out;

--%test(Includes XML header with encoding when encoding provided)
procedure check_encoding_included;

end;
/
2 changes: 1 addition & 1 deletion test/core/reporters/test_tfs_junit_reporter.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ create or replace package body test_tfs_junit_reporter as

procedure check_encoding_included is
begin
reporters.check_xml_encoding_included('check_fail_escape', ut3.ut_tfs_junit_reporter(), 'UTF-8');
reporters.check_xml_encoding_included(ut3.ut_tfs_junit_reporter(), 'UTF-8');
end;

end;
Expand Down
2 changes: 2 additions & 0 deletions test/install_tests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ set define on
@@install_below_12_2.sql 'core/reporters/test_coverage/test_html_proftab_reporter.pks'
set define off
@@core/reporters/test_tfs_junit_reporter.pks
@@core/reporters/test_sonar_test_reporter.pks
@@core/expectations.pks
@@core/expectations/scalar_data/binary/test_be_greater_or_equal.pks
@@core/expectations/scalar_data/binary/test_be_greater_than.pks
Expand Down Expand Up @@ -84,6 +85,7 @@ set define on
@@install_below_12_2.sql 'core/reporters/test_coverage/test_html_proftab_reporter.pkb'
set define off
@@core/reporters/test_tfs_junit_reporter.pkb
@@core/reporters/test_sonar_test_reporter.pkb
@@core/expectations.pkb
@@core/expectations/scalar_data/binary/test_be_greater_or_equal.pkb
@@core/expectations/scalar_data/binary/test_be_greater_than.pkb
Expand Down