Skip to content

Feature/reporters object model fix #589

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 26 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0434e17
`ut_output_buffer` is now fully abstracted from caller and caller can…
jgebal Jul 14, 2017
79b3702
Merge branch 'develop' into feature/reporters_object_model_fix
pesse Feb 12, 2018
a9031f4
Fixed some merge issues
pesse Feb 12, 2018
19ac972
We should keep installing ut_message_id_seq I guess...
pesse Feb 13, 2018
43b8754
Fixed output buffer and related test.
jgebal Feb 14, 2018
7fde523
Version number to 3 instead of X.X.X.X
pesse Feb 14, 2018
b8dc2a6
Output-Buffer no longer deletes contents during init
pesse Feb 21, 2018
8fefdcf
Added ut_output_reporter_base to synonyms and grants
pesse Feb 22, 2018
83e4b0b
Revert "Added ut_output_reporter_base to synonyms and grants"
pesse Feb 27, 2018
b4ece73
Added new member-function has_output to easily check
pesse Feb 27, 2018
94b7ea1
Merge remote-tracking branch 'upstream/develop' into feature/reporter…
pesse Feb 27, 2018
d792fec
Revert "Added new member-function has_output to easily check"
pesse Feb 28, 2018
202e697
Reapply "Added ut_output_reporter_base to synonyms and grants""
pesse Feb 28, 2018
bfde057
Add function to check whether a given name is a valid output reporter
pesse Feb 28, 2018
92f7b4c
Replace is_output_reporter by get_reporters_list
pesse Mar 4, 2018
5272342
Added description to all reporters
pesse Mar 5, 2018
7b34109
Unit-Test for get_reporters_list
pesse Mar 5, 2018
aae83f2
Fix get_reporters_list unit-test
pesse Mar 5, 2018
014981c
Merge remote-tracking branch 'upstream/develop' into feature/reporter…
pesse Mar 5, 2018
4488415
We have a Cobertura-Reporter now, too
pesse Mar 5, 2018
762727b
Improved reporter-description according to jgebal's suggestions
pesse Mar 6, 2018
7e428a1
Bump version to 3.1.0
pesse Mar 6, 2018
a466609
Merge remote-tracking branch 'upstream/develop' into feature/reporter…
pesse Mar 7, 2018
c0df23d
Added Cobertura Description
lwasylow Mar 7, 2018
cdacf29
Added Cobertura Description
lwasylow Mar 7, 2018
9504d1b
Merge remote-tracking branch 'upstream/develop' into feature/reporter…
pesse Mar 7, 2018
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.0.4-develop
v3.1.0-develop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ declare
suite1 ut_logical_suite;
suite2 ut_logical_suite;
suite_complex ut_logical_suite;
listener ut_event_listener;
l_reporter ut_output_reporter_base;
l_listener ut_event_listener;
l_run ut_run;
begin
suite1 := ut_logical_suite(a_object_owner=>null, a_object_name => null, a_name => null, a_description => 'Test Suite 1', a_path => null);
Expand Down Expand Up @@ -44,10 +45,11 @@ begin
suite_complex.items := ut_suite_items(suite1, suite2);

-- provide a reporter to process results
listener := ut_event_listener(ut_reporters(ut_custom_reporter(a_tab_size => 2)));
l_reporter := ut_custom_reporter(a_tab_size => 2);
l_listener := ut_event_listener(ut_reporters(l_reporter));
l_run := ut_run(ut_suite_items(suite_complex));
l_run.do_execute(listener);
ut_output_buffer.lines_to_dbms_output(listener.reporters(1).reporter_id,0);
l_run.do_execute(l_listener);
l_reporter.lines_to_dbms_output();
end;
/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ set echo off

PROMPT Runs test report using composite reporter
declare
suite ut_logical_suite;
listener ut_event_listener;
l_run ut_run;
suite ut_logical_suite;
l_doc_reporter ut_output_reporter_base := ut_documentation_reporter();
l_tc_reporter ut_output_reporter_base := ut_teamcity_reporter();
l_listener ut_event_listener := ut_event_listener(ut_reporters(l_doc_reporter, l_tc_reporter));
l_run ut_run;
begin
suite := ut_logical_suite(a_object_owner=>null, a_object_name => 'ut_exampletest', a_name => null, a_description => 'Test Suite Name',a_path => null);

Expand All @@ -36,11 +38,10 @@ begin
);

-- provide a reporter to process results
listener := ut_event_listener(ut_reporters(ut_documentation_reporter, ut_teamcity_reporter));
l_run := ut_run(ut_suite_items(suite));
l_run.do_execute(listener);
ut_output_buffer.lines_to_dbms_output(listener.reporters(1).reporter_id,0);
ut_output_buffer.lines_to_dbms_output(listener.reporters(2).reporter_id,0);
l_run.do_execute(l_listener);
l_doc_reporter.lines_to_dbms_output(0,0);
l_tc_reporter.lines_to_dbms_output(0,0);
end;
/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ set echo off

declare
suite ut_logical_suite;
listener ut_event_listener;
l_reporter ut_output_reporter_base;
l_listener ut_event_listener;
l_run ut_run;
begin
-- Install ut_custom_reporter first from example folder
Expand All @@ -40,10 +41,11 @@ begin
);

-- provide a reporter to process results tabbing each hierarcy level by tab_size
listener := ut_event_listener(ut_reporters(ut_custom_reporter(a_tab_size => 2)));
l_reporter := ut_custom_reporter(a_tab_size => 2);
l_listener := ut_event_listener(ut_reporters(l_reporter));
l_run := ut_run(ut_suite_items(suite));
l_run.do_execute(listener);
ut_output_buffer.lines_to_dbms_output(listener.reporters(1).reporter_id,0);
l_run.do_execute(l_listener);
l_reporter.lines_to_dbms_output(0,0);
end;
/

Expand Down
65 changes: 49 additions & 16 deletions old_tests/RunAll.sql
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ exec ut_coverage.coverage_start_develop();
@@lib/RunTest.sql ut_metadata/ut_metadata.form_name.TrimStandaloneProgramName.sql

@@lib/RunTest.sql ut_output_buffer/get_lines.RecievesALineFromBufferTableAndDeletes.sql
@@lib/RunTest.sql ut_output_buffer/send_line.DoesNotSendLineIfNullReporterIdGiven.sql
@@lib/RunTest.sql ut_output_buffer/get_lines.WaitsForMoreDataToAppearForSpecifiedTime.sql
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The work on this PR was initially started before switch to self-testing.
Would you be able to rewrite some of those tests to use new formula (utPLSQL v3 self-testing)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to, but will work on java-api before. That's something we can change after 3.1.0 as part of refactoring, can't we?

@@lib/RunTest.sql ut_output_buffer/get_lines.WaitsForTheDataToAppearForSpecifiedTime.sql
@@lib/RunTest.sql ut_output_buffer/send_line.DoesNotSendLineIfNullTextGiven.sql
@@lib/RunTest.sql ut_output_buffer/send_line.SendsALineIntoBufferTable.sql

Expand All @@ -93,6 +94,7 @@ exec ut_coverage.coverage_start_develop();
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileList.sql
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileListWithSutePaths.sql
@@lib/RunTest.sql ut/ut.run.AcceptsSutePaths.sql
@@lib/RunTest.sql ut/ut.run.ExecutesSuccesfullyAnEmptySuite.sql
@@lib/RunTest.sql ut/ut.run.FailsToExecuteAnInvalidPackageBody.sql
@@lib/RunTest.sql ut/ut.run.function.AcceptsCoverageFileList.sql
@@lib/RunTest.sql ut/ut.run.function.AcceptsCoverageFileListWithSutePaths.sql
Expand Down Expand Up @@ -252,6 +254,7 @@ begin
'source/api/ut_runner.pkb',
'source/api/ut_runner.pks',
'source/core/coverage',
'source/core/output_buffers',
'source/core/types',
'source/core/annotations/ut_annotation_manager.pkb',
'source/core/annotations/ut_annotation_manager.pks',
Expand All @@ -263,12 +266,8 @@ begin
'source/core/ut_expectation_processor.pks',
'source/core/ut_file_mapper.pkb',
'source/core/ut_file_mapper.pks',
'source/core/ut_message_id_seq.sql',
'source/core/ut_metadata.pkb',
'source/core/ut_metadata.pks',
'source/core/ut_output_buffer.pkb',
'source/core/ut_output_buffer.pks',
'source/core/ut_output_buffer_tmp.sql',
'source/core/ut_suite_manager.pkb',
'source/core/ut_suite_manager.pks',
'source/core/ut_utils.pkb',
Expand All @@ -281,6 +280,12 @@ begin
'source/core/coverage/ut_coverage_sources_tmp.sql',
'source/core/coverage/ut_coverage_reporter_base.tpb',
'source/core/coverage/ut_coverage_reporter_base.tps',
'source/core/output_buffers/ut_message_id_seq.sql',
'source/core/output_buffers/ut_output_buffer_base.tps',
'source/core/output_buffers/ut_output_buffer_info_tmp.sql',
'source/core/output_buffers/ut_output_buffer_tmp.sql',
'source/core/output_buffers/ut_output_table_buffer.tpb',
'source/core/output_buffers/ut_output_table_buffer.tps',
'source/core/types/ut_console_reporter_base.tpb',
'source/core/types/ut_console_reporter_base.tps',
'source/core/types/ut_coverage_options.tps',
Expand All @@ -292,15 +297,18 @@ begin
'source/core/types/ut_expectation_result.tpb',
'source/core/types/ut_expectation_result.tps',
'source/core/types/ut_expectation_results.tps',
'source/core/coverage/ut_file_mapping.tps',
'source/core/coverage/ut_file_mappings.tps',
'source/core/types/ut_file_mapping.tpb',
'source/core/types/ut_file_mapping.tps',
'source/core/types/ut_file_mappings.tps',
'source/core/types/ut_key_value_pair.tps',
'source/core/types/ut_key_value_pairs.tps',
'source/core/types/ut_logical_suite.tpb',
'source/core/types/ut_logical_suite.tps',
'source/core/types/ut_object_name.tpb',
'source/core/types/ut_object_name.tps',
'source/core/types/ut_object_names.tps',
'source/core/types/ut_output_reporter_base.tpb',
'source/core/types/ut_output_reporter_base.tps',
'source/core/types/ut_reporters.tps',
'source/core/types/ut_reporter_base.tpb',
'source/core/types/ut_reporter_base.tps',
Expand All @@ -317,6 +325,7 @@ begin
'source/core/types/ut_test.tpb',
'source/core/types/ut_test.tps',
'source/core/types/ut_varchar2_list.tps',
'source/core/types/ut_varchar2_rows.tps',
'source/expectations/data_values',
'source/expectations/matchers',
'source/expectations/ut_expectation.tpb',
Expand Down Expand Up @@ -347,6 +356,8 @@ begin
'source/expectations/ut_expectation_varchar2.tps',
'source/expectations/ut_expectation_yminterval.tpb',
'source/expectations/ut_expectation_yminterval.tps',
'source/expectations/data_values/ut_cursor_data.sql',
'source/expectations/data_values/ut_data_value.tpb',
'source/expectations/data_values/ut_data_value.tps',
'source/expectations/data_values/ut_data_value_anydata.tpb',
'source/expectations/data_values/ut_data_value_anydata.tps',
Expand Down Expand Up @@ -433,31 +444,34 @@ begin

--run for the first time to gather coverage and timings on reporters too
l_reporter := ut_coverage_html_reporter(a_project_name => 'utPLSQL v3');
:html_reporter_id := l_reporter.reporter_id;
l_reporter.after_calling_run(l_test_run);
l_reporter.finalize();

l_reporter := ut_coverage_sonar_reporter();
:sonar_reporter_id := l_reporter.reporter_id;
l_reporter.after_calling_run(l_test_run);
l_reporter.finalize();

l_reporter := ut_coveralls_reporter();
:coveralls_reporter_id := l_reporter.reporter_id;
l_reporter.after_calling_run(l_test_run);
l_reporter.finalize();

ut_coverage.coverage_stop_develop();

--run for the second time to get the coverage report
l_reporter := ut_coverage_html_reporter(a_project_name => 'utPLSQL v3');
:html_reporter_id := l_reporter.reporter_id;
l_reporter.after_calling_run(l_test_run);
l_reporter.finalize();
:html_reporter_id := l_reporter.get_reporter_id;

l_reporter := ut_coverage_sonar_reporter();
:sonar_reporter_id := l_reporter.reporter_id;
l_reporter.after_calling_run(l_test_run);
l_reporter.finalize();
:sonar_reporter_id := l_reporter.get_reporter_id;

l_reporter := ut_coveralls_reporter();
:coveralls_reporter_id := l_reporter.reporter_id;
l_reporter.after_calling_run(l_test_run);
l_reporter.finalize();
:coveralls_reporter_id := l_reporter.get_reporter_id;
end;
/

Expand All @@ -467,23 +481,42 @@ set termout off
set feedback off
set arraysize 50
spool coverage.xml
exec ut_output_buffer.lines_to_dbms_output(:sonar_reporter_id);
declare
l_reporter ut_output_reporter_base := ut_coverage_sonar_reporter();
begin
l_reporter.set_reporter_id(:sonar_reporter_id);
l_reporter.lines_to_dbms_output(a_initial_timeout=>1, a_timeout_sec=>1);
end;
/
spool off

set termout on
prompt Spooling outcomes to coverage.json
set termout off
spool coverage.json
select * from table(ut_output_buffer.get_lines(:coveralls_reporter_id));
declare
l_reporter ut_output_reporter_base := ut_coveralls_reporter();
begin
l_reporter.set_reporter_id(:coveralls_reporter_id);
l_reporter.lines_to_dbms_output(a_initial_timeout=>1, a_timeout_sec=>1);
end;
/
spool off

set termout on
prompt Spooling outcomes to coverage.html
set termout off
spool coverage.html
exec ut_output_buffer.lines_to_dbms_output(:html_reporter_id);
declare
l_reporter ut_output_reporter_base := ut_coverage_html_reporter();
begin
l_reporter.set_reporter_id(:html_reporter_id);
l_reporter.lines_to_dbms_output(a_initial_timeout=>1, a_timeout_sec=>1);
end;
/
spool off

set termout on
spool stats.log
exec mystats_pkg.ms_stop(1000);
spool off
Expand Down
2 changes: 1 addition & 1 deletion old_tests/helpers/utplsql_test_reporter.typ
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
create or replace type utplsql_test_reporter under ut_reporter_base(
create or replace type utplsql_test_reporter under ut_output_reporter_base(
constructor function utplsql_test_reporter(self in out nocopy utplsql_test_reporter) return self as result,
overriding member procedure after_calling_run(self in out nocopy utplsql_test_reporter, a_run in ut_run)
)
Expand Down
30 changes: 30 additions & 0 deletions old_tests/ut/ut.run.ExecutesSuccesfullyAnEmptySuite.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set termout off
create or replace package empty_suite as
-- %suite

procedure not_a_test;
end;
/
create or replace package body empty_suite as
procedure not_a_test is begin null; end;
end;
/
set termout on
declare
l_result integer;
begin
select *
into l_result
from table(ut.run('empty_suite',utplsql_test_reporter()));
--Assert
if l_result = ut_utils.tr_error then
:test_result := ut_utils.tr_success;
else
dbms_output.put_line('expected failure of ''empty_suite'' got: '''||ut_utils.test_result_to_char(l_result)||'''' );
end if;
end;
/

set termout off
drop package empty_suite;
set termout on
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--Arrange
declare
l_expected department$ := department$('hr');
l_actual department$ := department$('hr');
l_result integer;
begin
--Act
ut.expect( anydata.convertObject(l_actual) ).not_to_equal( anydata.convertObject(l_expected) );
l_result := ut_expectation_processor.get_status();
--Assert
if l_result = ut_utils.tr_failure then
:test_result := ut_utils.tr_success;
else
dbms_output.put_line('expected: '''||ut_utils.tr_success||''', got: '''||l_result||'''' );
end if;
end;
/
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 ).to_( be_false() );
ut.expect( 1 ).not_to( be_true() );
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_failure then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 = null ).to_be_false();
ut.expect( 1 = null ).not_to_be_true();
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_failure then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 = 1 ).to_be_false();
ut.expect( 1 = 1 ).not_to_be_true();
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_failure then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 = 0 ).to_be_false();
ut.expect( 1 = 0 ).not_to_be_true();
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_success then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 = 0 ).to_be_true();
ut.expect( 1 = 0 ).not_to_be_false();
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_failure then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 ).to_( be_true() );
ut.expect( 1 ).not_to( be_false() );
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_failure then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 = null ).to_be_true();
ut.expect( 1 = null ).not_to_be_false();
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_failure then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare
begin
--Act
ut.expect( 1 = 1 ).to_be_true();
ut.expect( 1 = 1 ).not_to_be_false();
l_result := ut_expectation_processor.get_status();
--Assert
if nvl(:test_result, ut_utils.tr_success) = ut_utils.tr_success and l_result = ut_utils.tr_success then
Expand Down
Loading