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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c787e47
Added support for multiple occurrences of before and after blocks.
jgebal Mar 4, 2018
2399981
tmp
jgebal Mar 14, 2018
2631355
Fixed issue with null items list.
jgebal Mar 15, 2018
a05475a
Redefined event listeners mechanism.
jgebal Mar 25, 2018
f955d2a
Redefined event listeners mechanism.
jgebal Mar 25, 2018
430f76f
Fixed minor bug in XUnit reporter (showing CDATA for errors even when…
jgebal Mar 25, 2018
2537ced
Changed propagation of rollback. Now rollback will propagate from par…
jgebal Mar 29, 2018
9308662
Fixed examples.
jgebal Mar 29, 2018
17ee8cb
Fixed test for empty description in 11g.
jgebal Mar 29, 2018
93be873
Fixed test for empty description in 11g.
jgebal Mar 29, 2018
75b96c3
Fixed double warning on missing endcontext annotation.
jgebal Mar 29, 2018
a6dadcc
fix in test to overcome 11g XML missing attributes in 3.0.4
jgebal Mar 30, 2018
4bc7ced
Merge branch 'develop' into feature/support_of_context
jgebal Apr 7, 2018
8a26845
Fixes after merging from develop.
jgebal Apr 7, 2018
e9c4e80
Fixed test failure on 11g R2 - some issues with LIKE operator, long p…
jgebal Apr 7, 2018
bfbfa43
Updated documentation.
jgebal Apr 7, 2018
9cd61bf
Marking first column as bold
jgebal Apr 7, 2018
1adf35d
Changed the way reporters events are registered.
jgebal Apr 14, 2018
71d0b70
Fixed issues with comment-replace in big package specs.
jgebal Apr 14, 2018
8617613
Updated test for comments removal to include multi-line comments with…
jgebal Apr 16, 2018
51ba943
Updated documentation with new and changed annotations.
jgebal Apr 16, 2018
ad3f830
Changed behaviour for duplicate annotations - first wins.
jgebal Apr 19, 2018
4346b57
Updates to documentation.
jgebal Apr 20, 2018
b1ff0fc
Updates to documentation.
jgebal Apr 20, 2018
ab5a1ca
Updated and extended documentation for annotations.
jgebal Apr 22, 2018
e672ef0
Added description of `context` to annotations documentation.
jgebal Apr 22, 2018
9897247
Merge remote-tracking branch 'origin/develop' into feature/support_of…
jgebal Apr 22, 2018
b2df93e
Integrated with develop branch changes.
jgebal Apr 22, 2018
d604127
Removed empty header from documentation.
jgebal Apr 24, 2018
9afb7be
A bit of code cleanup and tests alignment.
jgebal Apr 25, 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
1,342 changes: 1,198 additions & 144 deletions docs/userguide/annotations.md

Large diffs are not rendered by default.

35 changes: 17 additions & 18 deletions docs/userguide/expectations.md
Original file line number Diff line number Diff line change
Expand Up @@ -780,24 +780,23 @@ Since NULL is neither *true* nor *false*, both expectations will report failure.

The matrix below illustrates the data types supported by different matchers.

| | be_between | be_empty | be_false | be_greater_than | be_greater_or_equal | be_less_or_equal | be_less_than | be_like | be_not_null | be_null | be_true | equal | have_count | match |
|:------------------------------|:----------:|:--------:|:--------:|:---------------:|:-------------------:|:----------------:|:------------:|:-------:|:-----------:|:-------:|:-------:|:-----:|:----------:|:-----:|
| blob | | | | | | | | | X | X | | X | | |
| boolean | | | X | | | | | | X | X | X | X | | |
| clob | | | | | | | | X | X | X | | X | | X |
| date | X | | | X | X | X | X | | X | X | | X | | |
| number | X | | | X | X | X | X | | X | X | | X | | |
| timestamp | X | | | X | X | X | X | | X | X | | X | | |
| timestamp with timezone | X | | | X | X | X | X | | X | X | | X | | |
| timestamp with local timezone | X | | | X | X | X | X | | X | X | | X | | |
| varchar2 | X | | | | | | | X | X | X | | X | | X |
| interval year to month | X | | | X | X | X | X | | X | X | | X | | |
| interval day to second | X | | | X | X | X | X | | X | X | | X | | |
| refcursor | | X | | | | | | | X | X | | X | X | |
| nested table (as anydata) | | X | | | | | | | X | X | | X | X | |
| varray (as anydata) | | X | | | | | | | X | X | | X | X | |
| object (as anydata) | | | | | | | | | X | X | | X | | |

| Matcher |blob |boolean|clob |date |number|timestamp|timestamp<br>with<br>timezone|timestamp<br>with<br>local<br>timezone|varchar2|interval<br>year<br>to<br>month|interval<br>day<br>to<br>second|cursor|nested<br>table<br>/ varray|object|
|:----------------------|:---:|:-----:|:---:|:---:|:----:|:-------:|:---------------------------:|:------------------------------------:|:------:|:-----------------------------:|:-----------------------------:|:----:|:-------------------------:|:----:|
|**be_not_null** | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
|**be_null** | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
|**be_false** | | X | | | | | | | | | | | | |
|**be_true** | | X | | | | | | | | | | | | |
|**be_greater_than** | | | | X | X | X | X | X | | X | X | | | |
|**be_greater_or_equal**| | | | X | X | X | X | X | | X | X | | | |
|**be_less_or_equal** | | | | X | X | X | X | X | | X | X | | | |
|**be_less_than** | | | | X | X | X | X | X | | X | X | | | |
|**be_between** | | | | X | X | X | X | X | X | X | X | | | |
|**equal** | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
|**match** | | | X | | | | | | X | | | | | |
|**be_like** | | | X | | | | | | X | | | | | |
|**be_empty** | | | | | | | | | | | | X | X | |
|**have_count** | | | | | | | | | | | | X | X | |




Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,44 @@ set echo off
@@ut_custom_reporter.tpb

declare
suite1 ut_logical_suite;
suite2 ut_logical_suite;
suite_complex ut_logical_suite;
l_reporter ut_output_reporter_base;
l_listener ut_event_listener;
l_run ut_run;
l_parent_suite ut_logical_suite;
l_suite ut_suite;
l_test ut_test;
l_reporter ut_output_reporter_base;
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);

suite1.add_item(
ut_test(a_object_name => 'ut_exampletest'
,a_name => 'ut_exAmpletest'
,a_description => 'Example test1'
,a_before_test_proc_name => 'Setup'
,a_after_test_proc_name => 'tEardown')
);

suite2 := ut_logical_suite(a_object_owner=>null, a_object_name => null, a_name => null, a_description => 'Test Suite 2', a_path => null);

suite2.add_item(
ut_test(
a_object_name => 'UT_EXAMPLETEST2',
a_name => 'UT_EXAMPLETEST',
a_description => 'Another example test',
a_before_test_proc_name => 'SETUP',
a_after_test_proc_name => 'TEARDOWN')
);

suite_complex := ut_logical_suite( a_object_owner=>null, a_object_name => null, a_name => null, a_description => 'Complex Test Suite', a_path => null);
suite_complex.items := ut_suite_items(suite1, suite2);
ut_event_manager.initialize();
l_parent_suite := ut_logical_suite( a_object_owner=>null, a_object_name => null, a_name => 'complex_test_suite', a_path => null);

l_suite := ut_suite(user, 'ut_exampletest');
l_test := ut_test(user, 'ut_exampletest','ut_exAmpletest');
l_test.description := 'Example test1';
l_test.before_test_list := ut_executables(ut_executable(user, 'ut_exampletest','Setup',ut_utils.gc_before_test));
l_test.after_test_list := ut_executables(ut_executable(user, 'ut_exampletest','tEardown',ut_utils.gc_after_test));

l_suite.add_item(l_test);
l_parent_suite.add_item(l_suite);


l_suite := ut_suite(user, 'ut_exampletest2');
l_test := ut_test(user, 'UT_EXAMPLETEST2','UT_EXAMPLETEST');
l_test.before_test_list := ut_executables(ut_executable(user, 'UT_EXAMPLETEST2','SETUP',ut_utils.gc_before_test));
l_test.after_test_list := ut_executables(ut_executable(user, 'UT_EXAMPLETEST2','TEARDOWN',ut_utils.gc_after_test));

l_suite.add_item(l_test);
l_parent_suite.add_item(l_suite);

-- provide a reporter to process results
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(l_listener);
ut_event_manager.add_listener(l_reporter);
l_run := ut_run(ut_suite_items(l_parent_suite));
l_run.do_execute();
ut_event_manager.trigger_event(ut_utils.gc_finalize, l_run);
l_reporter.lines_to_dbms_output();
end;
/

drop type ut_custom_reporter;
drop package ut_exampletest;
drop package ut_exampletest2;
exec dbms_session.reset_package;
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
--Shows that even a very large package specification can be parsed quite quickly
--Clear Screen
Set Serveroutput On Size Unlimited format truncated
set serveroutput on
set echo off
--install the example unit test packages
@@tst_pkg_huge.pks

declare
l_suites ut_suite_items;
l_items ut_suite_items;
begin
l_suites := ut_suite_manager.configure_execution_by_path(ut_varchar2_list(USER||'.TST_PKG_HUGE'));
l_items := treat(
treat( treat( l_suites( 1 ) as ut_logical_suite ).items( 1 ) as ut_logical_suite ).items( 1 )
as ut_logical_suite
).items;
dbms_output.put_line('Created '||l_items.count||' tests in suite');
dbms_output.put_line(' Last test name='||l_items(l_items.last).name);
end;
/

Expand Down
54 changes: 24 additions & 30 deletions examples/developer_examples/RunExampleTestSuite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,37 @@ set echo off
@@ut_exampletest2.pkb

declare
suite ut_logical_suite;
listener ut_event_listener := ut_event_listener(ut_reporters());
test_item ut_test;
expectation ut_expectation_result;
l_suite ut_logical_suite;
l_test ut_test;
l_expectation ut_expectation_result;
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);
l_suite := ut_suite(user, 'ut_exampletest');
l_suite.description := 'Test Suite Name';
l_test := ut_test(user, 'ut_exampletest','ut_exAmpletest');
l_test.description := 'Example test1';
l_test.before_test_list := ut_executables(ut_executable(user, 'ut_exampletest','Setup',ut_utils.gc_before_test));
l_test.after_test_list := ut_executables(ut_executable(user, 'ut_exampletest','tEardown',ut_utils.gc_after_test));
l_suite.add_item(l_test);

suite.add_item(
ut_test(a_object_name => 'ut_exampletest'
,a_name => 'ut_exAmpletest'
,a_description => 'Example test1'
,a_before_test_proc_name => 'Setup'
,a_after_test_proc_name => 'tEardown')
);
l_test := ut_test(user, 'UT_EXAMPLETEST2','ut_exAmpletest');
l_test.description := 'Another example test';
l_test.before_test_list := ut_executables(ut_executable(user, 'UT_EXAMPLETEST2','SETUP',ut_utils.gc_before_test));
l_test.after_test_list := ut_executables(ut_executable(user, 'UT_EXAMPLETEST2','TEARDOWN',ut_utils.gc_after_test));
l_suite.add_item(l_test);

suite.add_item(
ut_test(
a_object_name => 'UT_EXAMPLETEST2',
a_name => 'UT_EXAMPLETEST',
a_description => 'Another example test',
a_before_test_proc_name => 'SETUP',
a_after_test_proc_name => 'TEARDOWN')
);

suite.do_execute(listener);
l_suite.do_execute();

-- No reporter used in this example so outputing the results manually.
for test_idx in suite.items.first .. suite.items.last loop
test_item := treat(suite.items(test_idx) as ut_test);
for test_idx in l_suite.items.first .. l_suite.items.last loop
l_test := treat(l_suite.items(test_idx) as ut_test);
dbms_output.put_line('---------------------------------------------------');
dbms_output.put_line('Test:' || test_item.item.form_name);
dbms_output.put_line('Result: ' || ut_utils.test_result_to_char(test_item.result));
dbms_output.put_line('Test:' || l_test.item.form_name);
dbms_output.put_line('Result: ' || ut_utils.test_result_to_char(l_test.result));
dbms_output.put_line('expectation Results:');
for i in 1 .. test_item.failed_expectations.count loop
expectation := test_item.failed_expectations(i);
dbms_output.put_line(i || ' - result: ' || ut_utils.test_result_to_char(expectation.result));
dbms_output.put_line(i || ' - Message: ' || expectation.message);
for i in 1 .. l_test.failed_expectations.count loop
l_expectation := l_test.failed_expectations(i);
dbms_output.put_line(i || ' - result: ' || ut_utils.test_result_to_char(l_expectation.result));
dbms_output.put_line(i || ' - Message: ' || l_expectation.message);
end loop;
end loop;
dbms_output.put_line('---------------------------------------------------');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,23 @@ declare
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);
ut_event_manager.initialize();
ut_event_manager.add_listener(l_doc_reporter);
ut_event_manager.add_listener(l_tc_reporter);

suite.add_item(
ut_test(a_object_name => 'ut_exampletest'
,a_name => 'ut_exAmpletest'
,a_description => 'Example test1'
,a_before_test_proc_name => 'Setup'
,a_after_test_proc_name => 'tEardown')
);
suite := ut_suite(user, 'ut_exampletest');
suite.description := 'Test Suite Name';

suite.add_item(
ut_test(
a_object_name => 'UT_EXAMPLETEST2',
a_name => 'UT_EXAMPLETEST',
a_description => 'Another example test',
a_before_test_proc_name => 'SETUP',
a_after_test_proc_name => 'TEARDOWN')
);
suite.add_item(ut_test(user,'ut_exampletest','ut_exAmpletest'));
suite.add_item(ut_test(user, 'UT_EXAMPLETEST2','UT_EXAMPLETEST'));

-- provide a reporter to process results
l_run := ut_run(ut_suite_items(suite));
l_run.do_execute(l_listener);
l_run.do_execute();

ut_event_manager.trigger_event(ut_utils.gc_finalize, l_run);
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 @@ -14,37 +14,34 @@ set echo off
@@ut_custom_reporter.tpb

declare
suite ut_logical_suite;
l_suite ut_logical_suite;
l_test ut_test;
l_reporter ut_output_reporter_base;
l_listener ut_event_listener;
l_run ut_run;
begin
ut_event_manager.initialize();
-- Install ut_custom_reporter first from example folder

suite := ut_logical_suite(a_object_owner=>null, a_object_name => 'ut_exampletest', a_name => null, a_description => 'Test Suite Name',a_path => null);
l_suite := ut_suite(user, 'ut_exampletest');

suite.add_item(
ut_test(a_object_name => 'ut_exampletest'
,a_name => 'ut_exAmpletest'
,a_description => 'Example test1'
,a_before_test_proc_name => 'Setup'
,a_after_test_proc_name => 'tEardown')
);
l_test := ut_test(user, 'ut_exampletest','ut_exAmpletest');
l_test.description := 'Example test1';
l_test.before_test_list := ut_executables(ut_executable(user, 'ut_exampletest','Setup',ut_utils.gc_before_test));
l_test.after_test_list := ut_executables(ut_executable(user, 'ut_exampletest','tEardown',ut_utils.gc_after_test));
l_suite.add_item(l_test);

suite.add_item(
ut_test(
a_object_name => 'UT_EXAMPLETEST2',
a_name => 'UT_EXAMPLETEST',
a_description => 'Another example test',
a_before_test_proc_name => 'SETUP',
a_after_test_proc_name => 'TEARDOWN')
);
l_test := ut_test(user, 'UT_EXAMPLETEST2','ut_exAmpletest');
l_test.description := 'Another example test';
l_test.before_test_list := ut_executables(ut_executable(user, 'ut_exampletest','SETUP',ut_utils.gc_before_test));
l_test.after_test_list := ut_executables(ut_executable(user, 'ut_exampletest','TEARDOWN',ut_utils.gc_after_test));
l_suite.add_item(l_test);

-- provide a reporter to process results tabbing each hierarcy level by tab_size
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(l_listener);
ut_event_manager.add_listener(l_reporter);
l_run := ut_run(ut_suite_items(l_suite));
l_run.do_execute();
ut_event_manager.trigger_event(ut_utils.gc_finalize, l_run);
l_reporter.lines_to_dbms_output(0,0);
end;
/
Expand All @@ -54,3 +51,4 @@ end;
drop type ut_custom_reporter;
drop package ut_exampletest;
drop package ut_exampletest2;
exec dbms_session.reset_package;
Loading